Friday, September 11, 2009

c programming interview question with solution


(1)void main(){int i='-'-'-';int a;clrscr();a=sizeof(i++,++i,1.1);printf(" a= %d i= %d",a,i);getch();}output : a=0 a=8(2)void main(){unsigned int i=-1;int j=-1;float b,c;clrscr();b=i+5.5;c=j+5.5;printf("%.0f %.0e\n",b,c);printf("%u\n",i*-1);printf("%u\n",-i*-1);getch();}output: 65540 4e+00165535(3)void main(){unsigned char a=-13;int b;clrscr();b=~(a^a);printf("%x %X\n",b);getch();}output:ffff

No comments:

Post a Comment