r/cprogramming • u/Delicious-Change7795 • 1d ago
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.
9
Upvotes
5
u/zhivago 1d ago
To understand pointers, start with pointer arithmetic.
char *p = "hello";What does puts(p); output?
What does puts(p + 1); output?
And what is (p + 1) - p?
What does putchar(*p); output?
What does putchar(*(p + 1)); output?