Pointers are variables that hold the address of another variable of same data type. Whenever a variable is declared , system will allocate a location to that variable in the memory to hold value.This location will have its own address number. A pointer variable therefore nothing but a variable that contains an address of another variable.
SYNTAX OF POINTER–
General syntax for pointer declaration is –
data-type *pointer_ name;
Data type of pointer must be same as the variable, which the pointer is pointing . Void type pointer works with all data types, but isn’t used often.
Example:
int a=10;
int *ptr=a;
here, *ptr stores address of variable ‘a’.
Leave a comment