#What is the point of a pointer ?

14 messages · Page 1 of 1 (latest)

steady beacon
#

Would someone please tell me or point me to an explanation in simple English, as to what is the point of a pointer ?

quiet shellBOT
#

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.

runic roost
#

do you mean why we need them?

steady beacon
runic roost
#

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

red wigeon
#

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.

steady beacon
#

@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 ?

red wigeon
#

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 )

steady beacon
#

alright thank you !

#

!solved

quiet shellBOT
#

Thank you and let us know if you have any more questions!