Pointer

Generally a pointer is one which points to something.In program, it means which points the memory address of a variable.

Syntax:
data-type *pointer-name = &variable-name;

Example:

Here p is int type pointer that means it can point a memory address of int type variable. Data type of pointer and pointing variable must be matched. An int type can’t point a variable of float type.

is invalid

A pointer points to a memory address – evidence by code
We can see the memory address created for a variable can be shown by “%u” format specifier.
Code Example:

output

Address of a = 3457867020
Address of a = 3457867020


Next Previous