Pointer - C Programme Simple Pointer Example.



Pointers are used in C program to access the memory and manipulate the address.

If you have a variable var in your program, &var will give you its address in the memory, where & is commonly called the reference operator.

You must have seen this notation while using scanf() function. It was used in the function to store the user inputted value in the address of var.

Programme :

Output :
Address of 30 variable: fff4
Address stored in ip variable: fff4
Value of *ip variable: 30

Note: You may obtain different value of address while using this code.

In above source code, value 30 is stored in the memory location fff4. var is just the name given to that location.

Follow me on:

Comments