main()

{

int i=4,j=7;

j = j || i++ && printf("YOU CAN");

printf("%d %d", i, j);

}



main() { int i=4,j=7; j = j || i++ && printf("YOU CAN"); ..

Answer / susie

Answer :

4 1

Explanation:

The boolean expression needs to be evaluated only till the
truth value of the expression is not known. j is not equal
to zero itself means that the expression’s truth value is 1.
Because it is followed by || and true || (anything) => true
where (anything) will not be evaluated. So the remaining
expression is not evaluated and so the value of i remains
the same.

Similarly when && operator is involved in an expression,
when any of the operands become false, the whole
expression’s truth value becomes false and hence the
remaining expression will not be evaluated.

false && (anything) => false where (anything) will
not be evaluated.

Is This Answer Correct ?    5 Yes 0 No

Post New Answer

More C Code Interview Questions

How can i find first 5 natural Numbers without using any loop in c language????????

2 Answers   Microsoft,


main() { char *p; p="Hello"; printf("%c\n",*&*p); }

1 Answers  


Is this code legal? int *ptr; ptr = (int *) 0x400;

1 Answers  


Program to Delete an element from a doubly linked list.

4 Answers   College School Exams Tests, Infosys,


Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };

1 Answers  






How we print the table of 2 using for loop in c programing?

14 Answers   HCL, Wipro,


main() { printf("\nab"); printf("\bsi"); printf("\rha"); }

3 Answers  


programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h

1 Answers  


main() { char c=' ',x,convert(z); getc(c); if((c>='a') && (c<='z')) x=convert(c); printf("%c",x); } convert(z) { return z-32; }

1 Answers  


#include<stdio.h> main() { FILE *ptr; char i; ptr=fopen("zzz.c","r"); while((i=fgetch(ptr))!=EOF) printf("%c",i); }

1 Answers  


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

1 Answers  


/*what is the output for*/ void main() { int r; printf("Naveen"); r=printf(); getch(); }

4 Answers  


Categories