View Single Post
  #12   Spotlight this post!  
Unread 22-03-2012, 11:37
StevenB StevenB is offline
is having FRC withdrawal symptoms.
AKA: Steven Bell
no team
Team Role: College Student
 
Join Date: May 2005
Rookie Year: 2005
Location: Stanford, CA
Posts: 416
StevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond repute
Re: C++ help: Understanding pointers?

First, be patient, take your time, and read as much as you can. There are lots of good discussions and documents online explaining the complexities of pointers. Pointers can be a difficult subject - I avoided them like the plague when I first learned C - but it's important to know them well. What you want to avoid is what one of my professors termed "Ninja coding": "If it doesn't compile, just throw a star at it". That causes confusion and chaos wherever you turn.

Quote:
Originally Posted by ctccromer View Post
P.S. Why are there references? They're just half-pointers.. Why not use pointers when you'd use references and have one less thing to remember?
References are really useful when you get into object-oriented programming, particularly when overloading operators (be patient, you'll get to this eventually). In short, they allow you to make functions that look and feel like pass-by-value without the overhead of actually doing a full copy. Do they do anything you couldn't do with pointers? No, but just like array bracket notation, they make some things more natural.

Now back to debugging a pointer bug in my homework...
__________________
Need a physics refresher? Want to know if that motor is big enough for your arm? A FIRST Encounter with Physics

2005-2007: Student | Team #1519, Mechanical Mayhem | Milford, NH
2008-2011: Mentor | Team #2359, RoboLobos | Edmond, OK
2014-??: Mentor | Looking for a team...