r/cprogramming • u/Delicious-Change7795 • Sep 12 '26
What are pointers?
I am new to C programming and i came through pointer. So can anyone tell what are they and why we need them? And if u can then can you give me reliable source to learn it.
17
Upvotes
View all comments
Show parent comment
1
u/musbur Sep 13 '26
And if you have a consecutive bunch (=array) of somethings and p ist a pointer to the first something, then p + 1 is a pointer to the second one and so on. Regardless of how many bytes one something occupies. The compiler knows how big one something is and the "distance" between them in memory (IOW, how they are aligned). It's called pointer arithmetics and is a powerful feature of C.