Showing posts with label c pointers. Show all posts
Showing posts with label c pointers. Show all posts

Monday, April 21, 2014

c pointer ex4


Output

c pointer ex3


Code

Output

Other: pritnf("%d",j); output: -14

C Pointer Ex1


Code
main(){
   int *j;
   {
       int i=10;
       j=&i;
       }
       printf("%d", *j);
       getch();
   }

Output

Similarly *j=&i; output: [Warning] assignment makes integer from pointer without a cast or *j=i; ERROR

C pointer ex2


Code
main(){
  char *str1="abcd";
  char str2[]="abcd";
  printf( "%d %d %d %d",sizeof(str1),sizeof(*str1),sizeof(str2),sizeof("abcd"));

  getch();
}

Output

c pointer ex1

code
main(){ char *cptr,c; void *vptr, v; c=10; v=0; cptr=&c; vptr=&v; printf(" %c %v " , c,v); }

OutPut