Passing function arguments by refrence
In C.
When you declare your function prototypes and you want to pass the argument values by refrence, do you have to use the indirection operator in the argument definition list? I haven't really done work with pointers for a while and I can't remember...
Also I wanted to know that since the memory address of an array just points to the first address in a contigous segment of addresses for each element, why is it that you can't access the memory addresses for the array elements other than the first one? And if you can, how can you do it?
Re: Passing function arguments by refrence
There's no pass by reference in C
In C there's only pass by Value
In C++ there's only pass by value and pass by reference
Re: Passing function arguments by refrence
The only way to pass by reference in C is to use pointers.
The address of the second element of an array can be written a + 1 or &a[1]
Re: Passing function arguments by refrence
Thanks twanvl. I didn't think about that. lol
So then using your example, every array element past the first one's can be accessed by incrementing the current element. Thx.
BTW... *slaps sunnypalsingh* :D Just kidding.
Re: Passing function arguments by refrence
Quote:
Originally Posted by GamerMax5
BTW... *slaps sunnypalsingh* :D Just kidding.
May I know what made you say so :(
Re: Passing function arguments by refrence
Feel free to PM eachother if you have an issue, but we don't need it in this forum.