Solution for Exercise 18-6

ex1806

#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' 0x7ffeea1baa1b
Address of 'i' 0x7ffeea1baa14
Address of 'f' 0x7ffeea1baa10
Address of 'd' 0x7ffeea1baa08

Notes

* The address values you see will be different.