Solution for Exercise 19-3
ex1903
#include <stdio.h> int main() { char c = 'c'; int i = 123; float f = 98.6; double d = 6.022E23; printf("Address of 'c' %p\n",c); printf("Address of 'i' %p\n",i); printf("Address of 'f' %p\n",f); printf("Address of 'd' %p\n",d); return(0); }
Output
Address of 'c' 0x63
Address of 'i' 0x7b
Address of 'f' 0x120a8
Address of 'd' 0x120a8
Notes
* The program compiles, but the output is suspect, of course.
* The warnings you see imply that a pointer value is expected when the %p
conversion character is used.
* The type 'void *'
in the warning message doesn't mean the void variable type was required. Instead, void *
is how the compiler expresses its desire for a pointer.
Copyright © 1997-2024 by QPBC.
All rights reserved