Basic help needed with pointers (double indirection)
Posted
by sbsp
on Stack Overflow
See other posts from Stack Overflow
or by sbsp
Published on 2010-03-15T08:34:47Z
Indexed on
2010/03/15
13:19 UTC
Read the original article
Hit count: 205
Hi, i asked some time ago on an account i cant remember how to manipulate basic pointers and someone gave me a really good demo
for example
char *ptr = "hello" (hello = a char array)
so now *ptr is pointing at h
ptr++
= moves the ptr to point at the next element, to get its value i do *ptr and that gives me e
ok so far i hope :D but now i need to manipulate a char **ptr
and was wondering how I do this in a way that mimmicks the effects of a 2d array?
some basic tips would be much appreciated as I need to do an assignment that has a **ptr
to imitate a 2d array and without knowing how it does this first means I cant even solve it on paper (for example, how do you dereference a **ptr, how do you get [x][y] values etc)
thanks
© Stack Overflow or respective owner