C – Pointers Type Declaration

Pointer Type Declaration

Same way as other variables, we have to declare pointers before we use them. Pointer declarations are the same as other declarations. When pointers are declared, the keyword for declaration is int, char, etc. declares the type of the pointer variable.

The pointer type specifies the type of the variable to which the pointer points. For each data type that can be declared in C, a corresponding type of pointer can be declared.

A given pointer only points to one particular type, not to all possible types.   The declaration of pointers variable gives the type and name of the new variable and reserves memory to hold its value.

The space reserved for a pointer variable is the same irrespective of its type, but the space reserved by its point may be different.

The pointer type is necessary for pointer arithmetic but not for its storage. To declare pointer variable and * is written before the variable,

data type * identifier

The above statement declares the identifiers to be a type “pointer to data type”.

This declaration allows spaces for the named pointer variable, but not for what it points to. For examples,
int *ip; for integer
char *cp; for character


float *fp; for floating

double *dp; for double