NettetFrom first term of the expression b=a++ + ++a; a++ means 10 but it will increase it value if it is use again. ++a means increase value of a immediately. What is value of a. It is 10, no it will change it value by 1 if it use again. So from above line its value is 11 and than increase value of a immediately its value is 12. So value of b = 22. NettetNone of the code in the question as currently shown has undefined behaviour. The requirements of the standard are clear. The assignments could/should be written c = …
int a=1,b;b=a++;求a和b--CSDN问答
Nettetwell I can tell you about C not about Java. In C all the pre-increments are carried out first: in this statement we have 2 pre-increaments so your a=5 becomes a=7. now adding them 7 + 7 is giving you 14. sorry, but no idea about Java internal expr. evaluation. Nettet23. aug. 2024 · Explanation: ++a +b = 6 + Garbage floating point number = Garbage floating point number // From the rule of automatic type conversion. Hence sizeof … mobily muebles
In C, is a+++b equal to a+b++? - Stack Overflow
Nettetint a=1; // initialization int b=0; // initialization b=++a + ++a; // find the pre-increment i.e. 2 increments of 'a' so now 'a' in this step will be incremented by 2 so now 'a' will contain 1+2=3. so now a=3. Again before assignment compute 'a+a' which is '3+3'=6 printf("%d %d",a,b); //3 6} Just a trick:- always compute the pre-increments in ... NettetIn an implementation, when we require to change the initial value of the variable by 1, then go for increment/decrement operators. I.e “++,--“. When we are working with increment/decrement operator the difference b/w existing value and a new value is +1 and -1 only. Depending on the position, these operators are classified into two types. Nettet29. nov. 2024 · Void main() { int a=10, b; b = a++ + ++a; printf("%d %d %d %d", b, a++, a, ++a); } what will be the output when following code is executed? A.12 10 11 13 B.22 12 12 13 C.22 11 11 11 D.22 14 12 13 See answers Advertisement Advertisement archanajhaasl archanajhaasl Answer: mobily neqaty