Advertisement

Lousy question, easy answer. pointers

Started by August 02, 2002 07:54 PM
0 comments, last by Sinner_Zero 22 years, 3 months ago
Ok, now I havent coded in 3 months so this is just getting worse and worse... however I am always reading about coding or something related to it. Anyways, heres my crummy question. Assuming something like this... typedef struct point_typ { int x, y, z; }point, *point_ptr; Whats the difference between these two... void Move_point( point &the_point ); or void Move_point( point_ptr the_point ); I mean... why would I want to use one over the other? or if the struct were to be more complex or possibly a class would there be a major difference between what the two funtions can do? OR might it just be that pointers in general are probabaly more flexable so it''s better to just work with a pointer to start with.
In general I stick with pointers mainly because they can be set to NULL unlike a reference. In general, if you''re always positive your value won''t be NULL, I don''t really see the harm in using a reference. If it can be NULL, then pointers are the way to go.
SysOp_1101

This topic is closed to new replies.

Advertisement