4 ms·
C doesn't have pass by reference.
by pikachu_is_cool 12y ago
C doesn't have pass by reference.
- krylon 12y agoNo, it does not. That is why pointers are so important in C. But to a newbie, the difference between a local variable and a pointer to it can be rather confusing, and the fact that with arrays this difference becomes rather blurry unless one has a good mental model of what the compiler turns your code into, makes it even more confusing. Given that some data structure such as linked lists are highly inconvenient or even impossible to implement without dynamic memory management, one is pretty much bound to writing code that is either primitive (not always a bad thing) or horrible to look at (and maintain) until one understands pointers.
- ArkyBeagle 12y agoIt has "pass a pointer by value", which works out conceptually to the same thing, only with slightly different syntax.
- pikachu_is_cool 12y agoYeah I was talking about this: > was using & to show pass-by-reference