CHAPTER 9

Pointers

Pointers are one of the most sophisticated features of the C language. A pointer is just another data type available in C. Understanding pointers needs the understanding of the meaning of an address. Below is given a brief discussion, the study of which helps in understanding the meaning of addresses and pointers.

We have been using variables declaration statements with almost all the functions developed hitherto. It is time to look closely to see what happens when a declaration statement is used. For example, consider the statement

int temp = 10;

The above statement:

  1. Reserves a memory location (of 2 bytes size).
  2. Names the memory location with the name temp.
  3. Stores an integer value 10 in the location.

At the machine level ...

Get Programming Techniques Through C: A Beginner's Companion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.