main(){

int a= 0;int b = 20;char x =1;char y =10;

if(a,b,x,y)

printf("hello");

}



main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) ..

Answer / susie

Answer :

hello

Explanation:

The comma operator has associativity from left to right.
Only the rightmost value is returned and the other values
are evaluated and ignored. Thus the value of last variable y
is returned to check in if. Since it is a non zero value if
becomes true so, "hello" will be printed.

Is This Answer Correct ?    22 Yes 1 No

Post New Answer

More C Code Interview Questions

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); }

1 Answers  


write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30

0 Answers  


what is the output of following program ? void main() { int i=5; printf("%d %d %d %d %d ",i++,i--,++i,--i,i); }

10 Answers  


Write a function to find the depth of a binary tree.

13 Answers   Adobe, Amazon, EFI, Imagination Technologies,


Display the time of the system and display the right time of the other country

1 Answers  






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

1 Answers  


main( ) { static int a[ ] = {0,1,2,3,4}; int *p[ ] = {a,a+1,a+2,a+3,a+4}; int **ptr = p; ptr++; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); *ptr++; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); *++ptr; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); ++*ptr; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); }

2 Answers   Persistent,


write a c-program to find gcd using recursive functions

5 Answers   HTC, Infotech,


plz tell me the solution.......... in c language program guess any one number from 1 to 50 and tell that number within 8 asking question in yes or no...............

2 Answers   Wipro,


create a C-code that will display the total fare of a passenger of a taxi if the driver press enter,the timer will stop. Every 10 counts is 2 pesos. Initial value is 25.00

0 Answers   Microsoft,


main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

2 Answers  


main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }

2 Answers   Wipro,


Categories