Advertisement

Pointers - needed as a beginner?

Started by June 10, 2002 07:56 AM
12 comments, last by sanguineraven 22 years, 6 months ago
Don''t forget to delete[]!
Heya Raven,

In my opinion, learn pointers and learn them now.

Here''s how:
1. Go grab a good book on how to code data structures.
2. Read through the chapters on linked and doubly-linked lists from start to finish.
3. Then code the data structures yourself.
4. Make sure to add an Insert(), Delete(), Search(), and Sort(), without looking back at the book if you can.

When all is said and done, and you''ve spent your 36 hours wondering why you keep getting memory errors, you''ll in the end, for better or for worse, understand pointers.

Best Regards,
Jeromy "Maverick" Walsh
------------------------
"The question isn''t how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" -Boondock Saints
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Advertisement
In my opinion you learn pointers early .. and they are important .. but NOT before you understand other groundwork ...

I had written plenty of stuff in GWBASIC as a kid, and then PASCAL before I knew pointers .. and I did just fine ... you will find this ... if you don''t know pointers ... to get any real work done you will use a lot of arrays and interger indexes ...

But you should NOT try to learn pointers before these things:

variable declaration, assignment, and comparison
conditionals (if, while, for)
function declarations and calls
basic I/O (using cin and cout)
simple file I/O

THEN you have two choice to go to next ... simple structs or classes, or pointers ... BOTH are easy to use, hard to completely understand as a beginner, and USED TOGETHER ... being able to write with CLASSES is almost useless without pointers ... because almost all abstract data structures (like lists, vectors, strings, stacks) ... use pointers ... and all dynamically sized things use pointers ...

Pointers are great, but they *are* hard to grasp for beginners. About the first 7-8 years of programming I did was without the use of pointers (or references for that matter) and I still managed to get a lot of stuff done. BASIC doesn't even have pointers (modern variants have references, though) so I will claim that you can get along perfectly well without pointers if you use a language such as BASIC.

However, if you insist on using C or C++ you will have a hard time avoiding pointers and you might as well just learn how to use them properly.

Just my 2 c.

[edited by - felonius on June 11, 2002 4:21:06 PM]
Jacob Marner, M.Sc.Console Programmer, Deadline Games

This topic is closed to new replies.

Advertisement