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);
}

Notes

* The program compiles, but the output is suspect, of course.

* The warning errors you may 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.