O'Reilly logo

C Programming: Visual Quickstart Guide by Marc Liyanage, Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required