Storing and Retrieving Addresses in Pointer Variables

The previous example just used the addresses of the variables in the printf() function. Now you'll look at how to store these addresses in other variables.

As mentioned earlier, an address is really just a big number. However, you should not treat an address as a regular number and store it in an int or long variable. If you try to do this, the C compiler will complain and emit a warning message (Figure 9.4).

Figure 9.4. Addresses should not be stored in regular integer variables.

Instead of using the regular numeric variable types to hold addresses, C requires you to ...

Get C Programming: Visual Quickstart Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.