Pointer in C

Pointer in C

What is Pointer in C?

A pointer in C is a type of variable which is used to store the address of another existing variable of its own type. It means the variable which is referred by pointer must be declared before the declaration of pointer. Pointer access the value stored at the memory location specified by the variable to which pointer is referring.

Syntax for declaring pointer:


S0 in the above example ptr is a pointer variable of integer type. Hence it can hold the address of integer type variable.

Free online test Powered By Quick Solution.

Some legal and illegal declaration of pointer variable:

Therefore in the above examples you might have observed the pointers assigned are of same types.Assigning different type of pointers leads to error.

Therefore the above declaration can be also done as follows:

So the two different types pointers can be assigned using typecasting. Therefore assignment of two different pointers can be done as follows:

Complete example of pointer using typecasting:

Void Pointer:

Void pointer is also known as “generic pointer” or “hollow pointer” which can store the address of another variable irrespective of its data type.

So pointer is one the best opted portion for interview questions as well as  quiz also.

Double pointer:

Double pointer is a variable which can store the address of the pointer.

Sony Playstation 4 1TB Console with 3 Free Games (The Last of US ,Drive Club and Infamous Second Son).

Click here to go program gallery of Quick Solution.




Leave a Reply