Hi =]
When Should I use pointer in functions?
example:
int something(int *i)
int something(int i)
Thanks
Hi =]
When Should I use pointer in functions?
example:
int something(int *i)
int something(int i)
Thanks
when you need change something you will have to pass a pointer to it.
>> when you need change something you will have to pass a pointer to it.
Not always, or else there wouldn't be a const attribute.
Also if you are passing an array to the function.
Psss by value == no pointer
pass by reference = use pointers as C does not have the reference oprerator '&'
Double Helix STL
No but it does have the address operator '&' , as Brian said you should pass a pointer when you wish to change its value, passing by value also uses more resources.
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
I was talking about the use of passing the address rather the value (mainly stucts). And I read the 'idea' in a book...