EmbLogic's Blog

Getting started with pointers

-> Pointers in c is variable which points the value stored in another location
-> It stores the logical addresses of the variable in which data is stored
->Size of a pointer depends on architecture of a workstation i.e
4bytes for 32 bit and 8bytes for 64 bit architecture
-> Representation of pointers
int *ptr;
//above expression points to the integer value stored in some location of memory.
-> Example
int *ptr;
int var=5;
ptr=&var;
printf(“Location stored in ptr is %p \n”,ptr); // ( it will print the the logical address of of varible var )

printf(“address of var is %x “,&var); // it will print the address of var

NOTE: check both the values and see the result …….
thank you

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>