I am learning C language and now I am confused with the output of the below snippet.
#include <stdio.h>
int main(void) {
    int p = 20;
    printf("%d\n",++p + p++);
    return 0;
}
How is the output of this 43?
As far as I have understood, it should be evaluating as below:
- ++pmakes it 21.
- p++, makes it 22 but will be- 21during addition since it is post-increment.
So the expected output should be 21 + 21 = 42. Isn't it?
