What is Pointer MME1322 Programming IIUM (PART 2)

How to declare a pointer variable

-pointer variables are declared using an asterisk( * ) The asterisk is called the indirection operator or the de-referencing operator).

example 1:

int a,b, *ptr;
ptr is a pointer to an integer

 example 2:

ptr=&x[0];
*ptr refers to x[0]

explanation: asterisk( * ) is an important symbol for pointer

example 3:

int a, *iPtr;
char s;
double *dPtr;

a  [______?______]

iPtr [______?______]

s [______?______]

dPtr[______?________]


Example 4;

explanation:The pointer have a relation between variables and memories