Home

Overview

Operators

Ex. Code

Errors

Importance

Links

 

What’s the point of using pointers? 

There are many instances where pointers will come in handy.  One benefit of pointers is saving space.  If for example you had a class that contained 10 doubles and an array of 100 strings that will take up quite of bit of memory.  If you need to reference it without pointers you would actually have to make a new copy of that whole thing and keep two of them in memory.  If you use a pointer instead you are using about 0.5% of the memory that you would have used otherwise.

As in the example above, you save space by using *terry to point to the char 'h'.   This may not seem like a problem with windows that has 100’s of MB of memory but if one day you are creating a program for an embedded system like the ones found in PDA’s or missiles you will only have a couple of KB of memory to work with.


Group 1: S. Bhatnagar, S. Guruda, K. Kaul, A. Jain