Answer P6

Pointer Variables contain Pointer Values

Yes. It prints the following on my computer:

a=45  pa=10577574

Comments: The statement

printf("a=%d  pa=%o\n", a, pa )

prints the contents of a (an ordinary integer) and then prints the contents of pa (using octal). The pointer variable pa contains a pointer value, and there is little reason to print it out, but it is OK to do so.

Without * in front of it, pa means get what pa contains.

On your computer you will see a different value for pa. pa contains the address of a, and that value depends on what choices the compiler, linker, and loader made.



Back to Puzzle Home