Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Pointers (http://www.go4expert.com/forums/pointers-t5046/)

boschow 2Jul2007 12:17

Pointers
 
Hi,
i just wanted to know, what are pointers used for?
when do we use pointer to a symbol?
when do we use pointer to a function?
when do we use pointer to a pointer . .. ?

Thanks for your time and help,
Best regards
BoSCHoW

shabbir 2Jul2007 12:53

Re: Pointers
 
Quote:

Originally Posted by boschow
i just wanted to know, what are pointers used for?

Mainly pointers are used for passing the address of the variables so the update in a function remains when the function is out of scope.
Quote:

Originally Posted by boschow
when do we use pointer to a symbol?

I assume you meant here variable and when we need the address of the variable.
Quote:

Originally Posted by boschow
when do we use pointer to a function?

I normally avoid using this but when we don't know which exact function to be called but know the type of the function. Is used for event handling where we don't know what is the event handler that will be assigned to the pointer but if its assigned it will have some standard signature.
Quote:

Originally Posted by boschow
when do we use pointer to a pointer . .. ?

As and when needed and in interviews.


All times are GMT +5.5. The time now is 03:50.