- #1
Avichal
- 295
- 0
"Pointers are variables that store address of another variable"
But I don't understand why such a thing was necessary. The only thing they are useful for is when we want to permanently change something passed to a function.
Since a function in C creates a local copy it only changes the value of parameters temporarily. But if we pass pointers it changes the address and hence we can permanently alter the value of the data passed to a function.
Well this is pointless. Instead of having pointers to do this they could have had an option whether to create a local copy or pass the original value to a function. Why need pointers?
Maybe I'm missing something, help me realize some usefulness of pointers.
Also is the array system of C bad? I have heard that it doesn't handle arrays properly. Why is that?
Thank you!
But I don't understand why such a thing was necessary. The only thing they are useful for is when we want to permanently change something passed to a function.
Since a function in C creates a local copy it only changes the value of parameters temporarily. But if we pass pointers it changes the address and hence we can permanently alter the value of the data passed to a function.
Well this is pointless. Instead of having pointers to do this they could have had an option whether to create a local copy or pass the original value to a function. Why need pointers?
Maybe I'm missing something, help me realize some usefulness of pointers.
Also is the array system of C bad? I have heard that it doesn't handle arrays properly. Why is that?
Thank you!