main()
{
int i=4,j=7;
j = j || i++ && printf("YOU CAN");
printf("%d %d", i, j);
}
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 |
main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }
main() { char s[ ]="man"; int i; for(i=0;s[ i ];i++) printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]); }
main() { extern int i; i=20; printf("%d",sizeof(i)); }
main() { char not; not=!2; printf("%d",not); }
main() { char *p; p="Hello"; printf("%c\n",*&*p); }
Is the following statement a declaration/definition. Find what does it mean? int (*x)[10];
typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }
Is it possible to type a name in command line without ant quotes?
void main() { int const * p=5; printf("%d",++(*p)); }
3 Answers Infosys, Made Easy, State Bank Of India SBI,
How we print the table of 2 using for loop in c programing?
Finding a number which was log of base 2
main( ) { void *vp; char ch = ‘g’, *cp = “goofy”; int j = 20; vp = &ch; printf(“%c”, *(char *)vp); vp = &j; printf(“%d”,*(int *)vp); vp = cp; printf(“%s”,(char *)vp + 3); }