My address checking code is,
#include <stdio.h>
int main(){
int num1, num2, *pNum1, *pNum2;
num1 = 123;
num2 = 321;
pNum1 = &num1;
pNum2 = &num2;
printf("pNum1 = %p\n", pNum1);
printf("pNum2 = %p\n", pNum2);
pNum2++;
printf("pNum2 = %p\n", pNum2);
printf("*pNum2 = %i\n", *pNum2);
return 0;
}
My output is,
I declared first num1 and second num2 and so on. variables keep according stack then num1 address should be higher than num2 but my output num2 is higher than num1. What is the reason?
please give an advise. Thank you.