English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
A pointer is a variable that stores the address of another variable. When we allocate memory for a variable, the pointer points to the address of that variable. The unary operator (*)is used to declare a variable, it returns the address of the allocated memory. A pointer to an array points to the address of the storage block of the array variable.
The following is the syntax of array pointer.
datatype *variable_name[size];
Here,
datatype-Data type of the variable, such as int, char, float, etc.
variable_name-This is the variable name given by the user.
size-Size of array variable.
The following is an example of an array pointer.
#include <stdio.h> int main () { int *arr[3]; int *a; printf("Value of array pointer variable: %d\n", arr); printf("Value of pointer variable: %d\n", &a); return 0; }
Output result
Value of array pointer variable: 1481173888 Value of pointer variable: 1481173880
In the above program, an array pointer is declared* arr and integer* a.
int *arr[3]; int *a;
The addresses of these pointers are printed as follows:
printf("Value of array pointer variable: %d\n", arr); printf("Value of pointer variable: %d\n", &a);