I'm having problems understanding pointers in C. Can someone help me please. i really need your help. got exams in a few days.
I'm having problems understanding pointers in C. Can someone help me please. i really need your help. got exams in a few days.
Browse this thread from a few days ago.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
... or the FAQ:
http://faq.cprogramming.com/cgi-bin/...&id=1043284351
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
Thanks a lot. i got so much problems with pointers and arrays. i tried a lot to learn about them but to no avail. hope i'll understand them now.
got any idea how to understand it quickly n in a simple manner. Thanks
Try explaining what you do understand and what is giving you problems. We will help you understand if we can, but we can't teach from scratch.
Definition: Politics -- Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers
A pointer is something that "points" at another variable. What it's doing is storing the memory address of that other variable, and then by using that, the other variable can be found, read, modified, whatever. It might not seem useful, but they're the sine qua non of cool stuff in C/C++.
Away.
Thx. i get problem with stuffs like **p=&a
++*arr
*++arr
++**arr+--arr[1][1]
*t++=*s++
stuffs like this.
thx
A pointer to a pointer to a pointer, dereferenced twice (giving you a pointer), being assigned the address of a variable.**p=&a
The pointer is dereferenced, and that value is incremented. This changes what is pointed at.++*arr
Dereference a pointer. Increment the pointer. This does not effect the dereferenced variable. It simply gives you the contents of the variable, then it increments the pointer.*++arr
Horrible.++**arr+--arr[1][1]
Dereference a pointer to a pointer, increment it (what's there), add to it the decremented value in a two dimensional array. Something like that. (Doing two things at once.)
Dereference two variables, make t hold whatever s is at said spot, then increment both pointers.*t++=*s++
Quzah.
Hope is the first step on the road to disappointment.
Thx. i'm really grateful to all of u guys who've taken the time to help me. i hope one day i'll be able to help others too like you just did. if i do get more problems, i know where i can get help. it makes me feel better to know there are pple willing to help me. thx a lot
Btw, i've noticed some of u have really cute avatars.