Hi all...my first post here...WOOHOO!! Ok...now to the meat of the question...
I'm a student at the the local JC in an intermediate C++ class...I'm having trouble understanding pointers...I just can't seem to get the full concept through my head...Can someone tell me how they finally "got it"? I understand (I think) the "->" operator, but I still don't understand exactly what it means if I've got a function header with a pointer as one of the arg's. ie

foo::somefunc(char *somevar)

what does that mean?????
If i've got some variable called

char *word[6]

do I call

somefunc(word)

or do I call

somefunc(*word)

What exactly is the difference?? And how do I refer to the variable w/in the somefunc function??
I'm soooo confused right now, and would appreciate any *pointers :cheesy: * you could give me....thanx!!

>>Hi all...my first post here...WOOHOO!! Ok...now to the meat of the question

Welsome to DaniWeb.:) Hope we see a lot more of you here and there. Please visit the Coffee House --> Community Introductons and tell us about yourself.

maybe you should read one of the pointer tutorials you can find on the net.

>>Can someone tell me how they finally "got it"?
through lots and lots of practice and experimenting.

>>What exactly is the difference
The difference is passing a single character or the address of the first element in the array. The star passes the first character in the array, while without the star passes the address of the first character.

>>What exactly is the difference?
Apart from reading up on the material given by AD above, just one note, remember that that "*" in somefunc(*word) is an operator. So try and figure out what the * operator does. The other operator of interest is "&" which does exactly the opposite of what "*" does. Understanding these 2 (on top of ->) would help immensely.

hi all...thanks for the tips...I guess I'll just have to play around with them for awhile until I'm proficient...

This article has been dead for over six months. Start a new discussion instead.