Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
0
Reason: A stack is used to store the parameters of any function in C and stack follows Last In First Out (LIFO) order. Therefore the parameter are evaluated in Right to Left order. Here they are assigned to the format specifier as soon as they are evaluated. x++ is post-increment operator. So value of x , which is 0 is assigned to 2nd %d and then gets incremented to 1. ++x is pre-increment operator. So value of x becomes 2 and is assigned to the first %d. -- ================== When two or more than two pre or post increment operators in the same statement, invokes undefined behaviour (based on the compiler). This means that there’s absolutely no temporal ordering in this process. The arguments can be evaluated in any order, and the process of their evaluation can be intertwined in any way.
27th Mar 2019, 7:01 AM
Prokopios Poulimenos
Prokopios Poulimenos - avatar