#What is the point of a pointer ?
14 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
do you mean why we need them?
there's plenty of learning resources that explain it well:
https://www.learn-c.org/en/Pointers
Yes, Why do they exist ? How do they help us ? In what ways can they be useful and harful ?
fundamentally, we need them because you need to refer to things, you can't just copy them everywhere all the time
a pointer to a file loaded into memory is just 8 bytes, but the file may be gigabytes
copying the pointer is cheap, copying the file is not
anyhow, learn-c the article explains the common use cases and stuff
you should go through that
Pointers exists for the reason Eisenchan said. For the harmful part you are asking, we can't exactly tell you now. You should learn C and then you will find out the harm pointers can do. The most common think that includes pointers and it can be harmful is the buffer overflow attack, if i am not wrong, if you want to search it.
@runic roost @red wigeon Thank you for answering my question and for the links ! I have a last followup question. Can pointers change what they are pointing to , without your knowledge somehow ?
Pointers can change the content that is stored in the address they are pointing to but they can't change it without the knowledge of the programmer ( except the programmer make accidentally a mistake )
Thank you and let us know if you have any more questions!