Programming
September 30, 2023Programming-for-Output-Problems
September 30, 2023Programming-for-Output-Problems
Question 27 |
If n has 3, then the statement a[++n]=n++;
assigns 3 to a[5] | |
assigns 4 to a[5] | |
assigns 4 to a[4] | |
what is assigned is compiler dependent |
Question 27 Explanation:
Given statement consists of three operators which are pre-increment , post-increment and equal to operator. According to operator precedence and associativity, the order of operators evaluation is post-increment,pre-increment and finally equal to operator.
But one variable value is modifying multiple times in the same expression means that behaviour is undefined behaviour which is compiler dependent.
But one variable value is modifying multiple times in the same expression means that behaviour is undefined behaviour which is compiler dependent.
Correct Answer: D
Question 27 Explanation:
Given statement consists of three operators which are pre-increment , post-increment and equal to operator. According to operator precedence and associativity, the order of operators evaluation is post-increment,pre-increment and finally equal to operator.
But one variable value is modifying multiple times in the same expression means that behaviour is undefined behaviour which is compiler dependent.
But one variable value is modifying multiple times in the same expression means that behaviour is undefined behaviour which is compiler dependent.
Subscribe
Login
0 Comments