Feed Headline Animator

What is pointer and pointer operators, explain

Pointer: -

A pointer is a variable, which is used to store the address of another variable.
For example
If we have a variable ‘T’ whose address is 1000 and its value is 5 let ‘B’ another variable which has the address number 1000 of ‘t’ and it has address 1003 then it will be as:
Variable Address Values
T 1000 5
B 1003 1000
So we can say ‘B’ is keeping the address of variable ‘T’ so it will be a pointer.

Pointer operators: -

The operators ‘&’ and ‘*’ are called the pointer operators. These operators are used to point the address of a variable as well as the content (value) of a variable.
So the operator ‘&’ is used to store the address of operator and the operator ‘*’ is used to store the content of that variable.
The pointer variable is declared as:
Data type
Data type * variable name;
For example
Int *a;
So a will be a pointer variable if this variable a has value 5 and it is started on address 1000 then
Printf (“%d”, a); --------------- (i)
Printf (“%d”, &a); ------------- (ii)
Printf (“%d”, *a); -------------- (iii)
So the result of (i) will be 5 and the result of (ii) will be 1000 and the result of (iii) will be 5.


Posted by: Wasim Javed

No comments:

Post a Comment