Why won't it print the address???
The error it's giving me is below
g++ -c -Werror main.cc
main.cc:20:33: error: format specifies type 'int' but the argument has type
'int *' [-Werror,-Wformat]
printf("Address of p is %d\n", p);
~~ ^
main.cc:22:30: error: data argument not used by format string
[-Werror,-Wformat-extra-args]
printf("Address p+1 is \n", p+1);
~~~~~~~~~~~~~~~~~~~ ^
2 errors generated.
make: *** [main.o] Error 1
Code:
int a = 10;
int* p;
p = &a;
int size = sizeof(int);
printf("Address of p is %d\n", p);
printf("Size of integer is %d\n", size);
printf("Address p+1 is \n", p+1);
g++ -c -Werror main.cc
main.cc:20:33: error: format specifies type 'int' but the argument has type
'int *' [-Werror,-Wformat]
printf("Address of p is %d\n", p);
~~ ^
main.cc:22:30: error: data argument not used by format string
[-Werror,-Wformat-extra-args]
printf("Address p+1 is \n", p+1);
~~~~~~~~~~~~~~~~~~~ ^
2 errors generated.
make: *** [main.o] Error 1