Posted By:
11 Jun, 2013 12:18 am PDT

Pointers in C and C++

How do we use pointers in c programming and explain what they do?
Attachment:None


Pointer is a variable whose value is the address of the memory location. Please watch the video for details...
Was it useful?  



Pointer is a variable whose value is the address of the memory location. Pointers are the extra feature that makes C and Cpp still stand in the competitive market along Java and all other languages.

Pointers are used to store the address of another variable. In

 

Var = 50 , The address of Var =1001. this case , address of Var = 1001 is stored in Pointer ptr.

To access the value 50 through the pointer we can directly use *ptr. This mean it extracts the value stored in the address.

*ptr=50.

Ptr=1001.

*ptr means , it gives the value stored in the address . ptr has the address of Var . so the value inside Var is displayed .

 Syntax for declaring a pointer is :

 

 data_type * pointer_variable_name;
Attachment: c-var-ptr.png
Was it useful?  




Please login to reply to this problem.