C
Programming and Technical
Programming
Technical
void main(){
int a=1;
void xyz(int , int);
xyz(++a,a++);
xyz(a++,++a);
printf("%d",a);
}
void xyz(int x, inty){
printf("%d%d",x,y);
}
Read Solution (Total 8)
-
- 22445
++a increments the value of a &.a=2 & prints 22 then a++ increments a & a=3
again ++a increments the value of a & prints 44 then a++ again increments to give a=5 - 8 years agoHelpfull: Yes(1) No(1)
- 31455 .++a=2,a++=1,
print 3,1
a=a++=3 - 8 years agoHelpfull: Yes(1) No(0)
- 31455
i have checked by compiling. - 8 years agoHelpfull: Yes(1) No(0)
- 31445 bcoz firstly on a++ value will be 1 then incremented to 2 and on prefix it become 3 then again prefix so so it becomes 4 and then postfix operation so it remains 4 but the value a will be 5,which will be printed. following right left rule.
- 8 years agoHelpfull: Yes(1) No(0)
- 2235
explain:- ++a is pre-increment ..so it 1st increment then assign the value
nd a++ is post -increment..so it 1st assign the previous value then increment it - 8 years agoHelpfull: Yes(0) No(1)
- 22355
a=1
fun1= ++a =2,
a++= 2 (displays 2 but stores 3, i.e displays 2 then gets incremented to 3 and it is stored)
fun2= a++= 3 (it displays 3 but stores as 4, i.e as above eg.) ,
++a=5 (increments first bcoz of pre (++) operator)
finally a has to be printed and the value is 5
- 8 years agoHelpfull: Yes(0) No(1)
- 31455
doing right to left operations
- 8 years agoHelpfull: Yes(0) No(0)
- 31445 in turbo. function argument operation left to right .
xyz(3, 1);
xyz(4,4);
a=5 - 8 years agoHelpfull: Yes(0) No(0)
C Other Question