Pointer plays a very important role in C language.
Pointers are the variables which store the address of another variable.
              The general syntax for defining a pointer is as follows:-
                                * ;
For example: –    if we define.
                                                     int  *p
     The meaning of this line is that p is a pointer of integer type i.e. it store the address of integer type variable.
C Pointer Syntax
Pointers require a bit of new syntax because when you have a pointer, you need the ability to both request the memory location it stores and the value stored at that memory location. Moreover, since pointers are somewhat special, you need to tell the compiler when you declare your pointer variable that the variable is a pointer, and tell the compiler what type of memory it points to.

The pointer declaration looks like this:

For example, you could declare a pointer that stores the address of an integer with the following syntax:

int *points_to_integer;
Notice the use of the *. This is the key to declaring a pointer; if you add it directly before the variable name, it will declare the variable to be a pointer. Minor gotcha: if you declare multiple pointers on the same line, you must precede each of them with an asterisk:
/* one pointer, one regular int */
int *pointer1, nonpointer1;
/* two pointers */
int *pointer1, *pointer2;

Keywords: pointer in c programming, how to declare pointer in c, how to intiliaze pointer ?how to use pointer in c programming?, definition of pointer


Leave a Reply

Your email address will not be published. Required fields are marked *