85. Predict the output or error(s) of the following c code
1 2 3 4 5 6 7 | main() { int i =0;j=0; if(i && j++) printf("%d..%d",i++,j); printf("%d..%d,i,j); } |
October 9th, 2011
1 2 3 4 5 6 7 | main() { int i =0;j=0; if(i && j++) printf("%d..%d",i++,j); printf("%d..%d,i,j); } |
October 9th, 2011
1 2 3 4 5 6 7 8 9 | #include "stdio.h" main() { FILE *ptr; char i; ptr=fopen("zzz.c","r"); while((i=fgetch(ptr))!=EOF) printf("%c",i); } |
October 9th, 2011
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include "stdio.h" aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2](); } |
October 9th, 2011
1 2 3 4 5 6 7 8 9 | #include "stdio.h" int one_d[]={1,2,3}; main() { int *ptr; ptr=one_d; ptr+=3; printf("%d",*ptr); } |
October 9th, 2011
1 2 3 4 5 6 7 8 9 10 11 | main(int argc, char **argv) { printf("enter the character"); getchar(); sum(argv[1],argv[2]); } sum(num1,num2) int num1,num2; { return num1+num2; } |
October 9th, 2011
1 2 3 4 5 6 7 8 9 10 11 12 13 | main() { char c=' ',x,convert(z); getc(c); if((c>='a') && (c<='z')) x=convert(c); printf("%c",x); } convert(z) { return z-32; } |
September 15th, 2011
1 2 3 4 5 6 7 8 9 10 11 | main() { char *p; int *q; long *r; p=q=r=0; p++; q++; r++; printf("%p...%p...%p",p,q,r); } |
September 15th, 2011
1 2 3 4 5 6 7 8 9 10 | main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); } |
September 15th, 2011
1 2 3 4 5 6 7 8 9 10 11 12 | struct point { int x; int y; }; struct point origin,*pp; main() { pp=&origin; printf("origin is(%d%d)\n",(*pp).x,(*pp).y); printf("origin is (%d%d)\n",pp->x,pp->y); } |
September 15th, 2011
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); } |
September 15th, 2011