+ 1

How should I practice to be fluent using pointer in "C"?

I find it difficult to use pointers in C. Though I was taught C programming at university this year, teachers skipped pointer chapter. I tried to do self-study. But, it's more difficult than I thought.😦 So, please advise me how I should do.

31st Oct 2018, 3:49 AM
Ye Oo
Ye Oo - avatar
3 Réponses
+ 3
Try implementing your own linked lists. Each node in the list will have a pointer to the next (or previous) node in the list. You'll have to manage the allocation and deallocation of the pointers during their lifetime. Try doing simple things that don't even require pointers, but do them with pointers anyway.
31st Oct 2018, 4:22 AM
Zeke Williams
Zeke Williams - avatar
+ 2
You can start with what you think you know about pointers. Then draw conclusions from there about what should happen if you did this-and-that. (for example print addresses, if p is a ptr to int, what is the address of ++p ?). Then write that "this-and-that" as program and verify your assumptions. Has so far always worked for me when I learn autodidactically. If you have a debugging tool available, use it! Inspect memory regions and step through pointer arithmetics line by line looking at what and how it changes.
31st Oct 2018, 7:24 AM
Leif
Leif - avatar
0
Yeshwanth Kumar What you dont understood about pointers?
31st Oct 2018, 6:01 AM
KrOW
KrOW - avatar