Advertisement

Pointers

Started by June 12, 2000 09:32 AM
2 comments, last by Krylar 24 years, 6 months ago
Hiya, Are there any really good articles on the net that get deep into Pointers? I know the basics and can build a linked list and such, but some of the posts I''m seeing on this board clearly demonstrate that I''m still quite the neophyte. Things like... int f(int (*a) (), double (*b)[3]); int f(int (*a)(char *), double (*b)[]); ...make my brain hurt (btw, I got a description of those already. You can check it out, if interested, at "http://www.cs.wustl.edu/~jxh/CLOJ/volume01/subjects01/composite_type"). So, anybody know of a good book or articles that really delve deeply (and clearly from a newbie perspective) into the goodies of Pointer use? Thanks! -Krylar
"I learned everything I ever needed to know about pointers from ACE Computer Camp" I am not exactly a pointer-god, but one day at computer camp, a friend and I were making an Xtreme Pong clone (with non-beatable AI without modifications), and suddenly everything clicked. I instantly got the whole concept and all (most) of those cast operators... My advice is just stare at it until you understand it After wading through Pong for a week, I was quite well versed in pointers (and debugging )

--------------------


You are not a real programmer until you end all your sentences with semicolons;

Yanroy@usa.com

Visit the ROAD Programming Website for more programming help.

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

Advertisement
My advice would just be to go through life hoping that you never encounter a situation where you sit up and say, "Damnit! If only I knew how to create and use a pointer to a function that returns a pointer to an array of pointers to functions that return pointers to integers!" I don't know about you, but I just can't imagine a use for that stuff in the kind of programs I write.

-Ironblayde
 Aeon Software

Edited by - Ironblayde on June 13, 2000 1:35:08 AM
"Your superior intellect is no match for our puny weapons!"
Any good c++ introductory book should give you the scoop on pointers.

How to approach?

1. Simple pointers to variables like TYPE*
2. Pointers and const: const TYPE* and TYPE* const and const TYPE* const
3. References to variables :TYPE&
4. Arrays and their pointer analogy: TYPE list[5]
5. Poniters to pointer: TYPE**
6. Casts: (TYPE*) or static_cast, dynamic_cast, const_cast, reinterpret_cast
7. Semantic of pointers as function arguments
8. Pointers to functions RETURNTYPE (*func)(AGRUMENTS)
9. Pointers to object elements: RETURNTYPE (CLASSTYPE::*ELEMENT)(ARGUMENTS)

All these cases are explained in "The C++ programming language 3. or 4. Edition" form Bjarne Stroustrup (however this book isn''t really good as a reference).

Do you have an explicit question now - post here :-) Or do you want a broad insight into all of it - post here ;-)

Bjoern

P.S.: The thing that makes your brain hurt are pointers to functions - they got a really "funny" syntax (where to place the damned *).

This topic is closed to new replies.

Advertisement