main()

{

int i=-1,j=-1,k=0,l=2,m;

m=i++&&j++&&k++||l++;

printf("%d %d %d %d %d",i,j,k,l,m);

}



main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf(&qu..

Answer / susie

Answer :

0 0 1 3 1

Explanation :

Logical operations always give a result of 1 or
0 . And also the logical AND (&&) operator has higher
priority over the logical OR (||) operator. So the
expression ‘i++ && j++ && k++’ is executed first. The
result of this expression is 0 (-1 && -1 && 0 = 0). Now
the expression is 0 || 2 which evaluates to 1 (because OR
operator always gives 1 except for ‘0 || 0’ combination- for
which it gives 0). So the value of m is 1. The values of
other variables are also incremented by 1.

Is This Answer Correct ?    39 Yes 11 No

Post New Answer

More C Code Interview Questions

To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates.

19 Answers   Amazon, BITS, Microsoft, Syncfusion, Synergy, Vector,


Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

1 Answers  


# include <stdio.h> int one_d[]={1,2,3}; main() { int *ptr; ptr=one_d; ptr+=3; printf("%d",*ptr); }

1 Answers  


What is the hidden bug with the following statement? assert(val++ != 0);

1 Answers  


main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }

1 Answers  






void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }

1 Answers  


main() { static int a[3][3]={1,2,3,4,5,6,7,8,9}; int i,j; static *p[]={a,a+1,a+2}; for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j), *(*(j+p)+i),*(*(i+p)+j),*(*(p+j)+i)); } }

1 Answers  


int main() { int x=10; printf("x=%d, count of earlier print=%d", x,printf("x=%d, y=%d",x,--x)); getch(); } ================================================== returns error>> ld returned 1 exit status =================================================== Does it have something to do with printf() inside another printf().

1 Answers  


what is oop?

3 Answers  


main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }

6 Answers  


void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n"); }

3 Answers   Accenture,


main( ) { int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}}; printf(“%u %u %u %d \n”,a,*a,**a,***a); printf(“%u %u %u %d \n”,a+1,*a+1,**a+1,***a+1); }

2 Answers  


Categories