C - Pointer Type Declaration

C - Pointer Type Declaration, what is pointer and how to declare pointer on c programming C - Pointer Type Declaration

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

The pointer type specifies the type of the variable which 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 same irrespective of its type but the space reserved by its point may be different.

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

This 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

You May Also Like...

Subscribe Us