2,311 views
0 votes
0 votes
#include<stdio.h>
int main()
{
    int a = 5;
    int b = ++a * a++;
    printf("%d ",b);
    return 0;
}

(a) 25 (b) 30 (c) 36 (d) Undefined Behavior

1 Answer

Best answer
3 votes
3 votes

Ans should be D) Undefined Behavior

as here variable n is modified multiple time and not  any intermediate sequenced  .so it gives undefined behavior .

you can refer here also : http://gatecse.in/wiki/Undefined_Value

selected by

Related questions

0 votes
0 votes
2 answers
1
Desert_Warrior asked May 16, 2016
8,789 views
#include<stdio.h int main() { int a = 5; switch(a) { default: a = 4; case 6: a ; case 5: a = a+1; case 1: a = a-1; } printf("%d \n",a); return 0; }(a) 5 (b) 4 (c) 3 (d) N...
0 votes
0 votes
1 answer
3
Desert_Warrior asked May 16, 2016
5,131 views
#include<stdio.h int main() { char c=125; c=c+10; printf("%d",c); return 0; }(a) 135 (b) +INF (c) -121 (c) -8
0 votes
0 votes
1 answer
4
Desert_Warrior asked May 16, 2016
1,538 views
#include<stdio.h int main() { int i=10; static int x=i; if(x==i) printf("Equal"); else if(x>i) printf("Greater"); else printf("Lesser"); return 0; }(a) Equal (b) Greater ...