plz. say the advantages of pointer in c

India
December 8, 2006 7:10am CST
i have read the pointer for c-language. I want to know the advantages and usefullness of pointer with respect to array, function and structure.
3 responses
@starsun (316)
• India
8 Dec 06
C language uses pointers a lot. Reasons for it are 1.It is the only way to express some computations. 2.It produces compact and efficient code. 3.It provides a very powerful tool. If u want to know more about pointers visit: publications.gbdirect.co.uk/c_book/chapter5/pointers.html
1 person likes this
• India
8 Dec 06
Thanks for your advise. i will go through your advise.
@cr1st1nel (3567)
• Romania
8 Dec 06
What i remember is that the point stores the variable ... or something like this.
1 person likes this
• India
8 Dec 06
Actually pointer is a special type of variable which stores the physical address of a variable instead of actual values.
@dholey (1383)
• India
20 Dec 06
THERE Are many advantages using pointers as well as there are few disadvantages too, pointer are special variables which deals with the ADDRESS OF OTHEr VARIABLES, once the address of any variable is stored then that variable cane accessed using this pointer EX:- int x=10, *p; /* p is a pointer to integer type */ p =&x; /* after the statement , the address of x is stored in p, now after it , where ever you want to use &x , ou an say p ,and when you want to get the value of x you can see *p */ using pointer you can access any location of the memory , it also help to save memory wastage, for ex char str[2][50] ={"dholey knows c","amit8sinka is also a lover of c"}; in this declaration (if the name is not to be changed throughout the program) man bytes of memory is wasted , now in the below declaration char *p[2] ={"dholey knows c","amit8sinka is also a lover of c"}; array of poiners is created, in memory some where the string will be created (with exactly that amount of bytes which is needed to save them) and the base address of the strings are saved in the array of pointers using pointers we can create dynamic vriables / arrays int *p; p= (int *) malloc(10); p becomes an array of 5 int variables there are many more things , you can learn it reading POINTER IN C B KANITKAR, OR THE CODE IN C (THIS IS THE BEST BOOK i have forgotten the other's name )
@dholey (1383)
• India
21 Dec 06
ther are more books , if you are interested i will mention names here in the comments.