-
pointers
Does anyone know a good place to find examples and an explanation to learn pointers? I have looked through several posts, books, and online and can't find a good beginner's explanation with examples. All I know about pointers is
for example:
int number;
int *p;
p = &number;
I don't know how with characters though because with characters you have to give it storage like char this[15];
Can anyone offer something that might help, whether it be your example & explanation, a book, or somewhere online..any suggestions? Thank you.
-
Use this sites tutorials. They're usualy pretty good. Bascially, a pointer is just an address. You know that, but here's why. If you need to pass a whole array to a function, it's hard. So you pass the pointer, initialized to the first element. Then to get the next part, you just use pointername++, to increment it to the next spot in memory. It's a broad subject with dereferincing and all, so try and ask specific questions.
-
There is a fellow named Marshal Brain that has a site called How Stuff Works. It has a section on C, which includes discussions of pointers. I found it to be good and you can find it at:
http://www.howstuffworks.com/c.htm
-
-
-
Thanks a lot everybody. It's a lot of help :-)