Pointer Characteristics

Computer’s memory is made up of a sequential collection of storage cells called bytes. Each byte has a number called an address associated with it. When we declare a variable in our program, the compiler immediately assigns a specific block of memory to hold the value of that variable. Since every cell has a unique address, this block of memory will have a unique starting address. The size of this block depends on the range over which the variable is allowed to vary.

For example, on 32 bit PC’s the size of an integer variable is 4 bytes. On older 16 bit PC’s integers were 2 bytes. In C the size of a variable type such as an integer need not be the same on all types of machines. If you want to know the size of the various data types on your system, running the following code given in the Example will give you the information.

Write a program to know the size of the various data types on your system.

# include <stdio.h>
main( )
printf (“n Size of a int = %d bytes”, sizeof (int));
printf (“\n Size of a float = %d bytes”, sizeof (float));
printf (“\n Size of a char = %d bytes”, sizeof (char));


Size of int = 2 bytes
Size of float = 4 bytes
Size of char = 1 byte

An ordinary variable is a location in memory that can hold a value. For example, when you declare a variable num as an integer, the compiler sets aside 2 bytes of memory (depends up the PC) to hold the value of the integer. In your program, you refer to that location in memory by the name num. At the machine level that location has a memory address.

int num = 100;

We can access the value 100 either by the name num or by its memory address. Since addresses are simply digits, they can be stored in any other variable. Such variables that hold addresses of other variables are called Pointers.

In other words, a pointer is simply a variable that contains an address, which is a location of another variable in memory. A pointer variable “points to” another variable by holding its address. Since a pointer holds an address rather than a value, it has two parts. The pointer itself holds the address. That addresses points to a value. There is a pointer and the value pointed to. This fact can be a little confusing until you get comfortable with it, but once you get familiar with it, then it is extremely easy and very powerful.

Let us see the important features of the pointers as follows:

Characteristic features of Pointers

With the use of pointers in programming,

  1. The program execution time will be faster as the data is manipulated with the help of addresses directly.
  2. Will save the memory space.
  3. The memory access will be very efficient.
  4. Dynamic memory is allocated.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: