Thursday, July 9, 2009

What is Pointer in 'C'?

gdfg

What is Pointer in 'C'?
Pointer is which stores the location of another variable.
Reply:it's (basically) a variable that stores an address to another variable.





http://en.wikipedia.org/wiki/Pointer_%28...
Reply:whatecer ^^^^^ said
Reply:It stores the memory address of where the variable/structure is stored.
Reply:http://www.cplusplus.com/doc/tutorial/po...
Reply:Basically pointers are the variables which can hold the address of another variables. It takes two bytes of memory because any address in memory will be of integer type(Hexa decimal) and integer takes two bytes to store.


To define a pointer we use astrick(*). For example


int *a;





we use astrick only at the time of pointer declaration.After this we use pointer without pointer. We can store the address of another variable in pointer as follows


int *a;


float b;


b=3.5;


a=b;


We can see the address of variable 'b' as follows


printf("The address of b is: %u",a);


We can see value of 'b' by using pointer as follows


printf("The value of 'b' is : %f",*a);





We read a=value of a


and *a=value at value of a


No comments:

Post a Comment