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

PROG. TO PRODUCE 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1

1 Answers  


Who could write how to find a prime number in dynamic array?

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,


how to return a multiple value from a function?

2 Answers   Wipro,


main() { int i=10,j=20; j = i, j?(i,j)?i:j:j; printf("%d %d",i,j); }

2 Answers   Adobe, CSC,






Is the following statement a declaration/definition. Find what does it mean? int (*x)[10];

1 Answers  


¦void main() ¦{ ¦int i=10,j; ¦ j=i+++i+++i; ¦printf("%d",j); ¦getch(); ¦} ¦ output:-30 but in same question if we write as- ¦void main() ¦{ ¦int i=10; ¦ int j=i+++i+++i; ¦printf("%d",j); ¦getch(); ¦} ¦ output:-33 why output is changed from 30 to 33. Can any body answer...

3 Answers  


Write a C program to add two numbers before the main function is called.

11 Answers   Infotech, TC,


char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)

1 Answers  


main() { char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); }

3 Answers  


main() { struct date; struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

1 Answers  


main() { if (!(1&&0)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above

3 Answers   HCL,


Categories