My biggest problem right now in understanding c++ is pointers.

Im curious to its specific funcionality, so instead of doing somthing like
p = &x
then calling x using *p, why couldn't you just say x = p?

Im pretty sure my syntax is wrong, but hopefully i'm getting my question across properly. Thanks!

pointers are just like ordinary variables that carry the address of other variables and objects. you need pointers because sometimes when passing information within your program, let say from a function to a function, you dont want to pass all the data, instead you want to pass the address of that data in memory, that is when pointers become useful. they are also used for memory management as they are able to address to memory.

i have an apple analogy for you, if you ask for an apple, i can bring it to you, or i can say that it is in the kitchen and you can go and grab it. i am not a good c++ programmer though, but it is easy to understand things when some one is as bad as you :)

I also had a big problem understanding pointers, but it's not that hard:
pointers are just like any other variables when you use the asterisk (*) before them - which leads to the value in the address they hold.
They're useful because, just how serkansendur said, you can save computer memory when passing them to functions (because you send the whole address and not a copy of the variable), and you can manage the variables' values throught them.
Passing an address to a pointer in a function is similar to sending a reference (with the prefix &) to a function, except that a reference can't get a new address to refer to.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.