Jump to content
  • Advertisement
Sign in to follow this  


This topic is 4524 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
-loop iteration
-dynamic memory allocation
-function pointers
-dividing a datam into smaller parts witbout moving its bits around

Share this post

Link to post
Share on other sites
Sorry... don't quite understand your question.

Pointers in C++ are alot like pointers in other languages. Pointers *point* (no pun intended) to a location in memory. It is like a handle (my own term, not the C++/CLI handle) that allows you to manipulate that piece of memory.

Some common uses of pointers:

1) manipulating values/objects
Instead of passing around by value that can get pretty inefficient in terms of the value/object copying, you pass around the pointer to that value/object. You can then manipulate that value/object via its pointer using "->" operator.

2) manipulating functions
Using function pointers (i.e.: pointers that point to functions of specific prototype), you can actually get your program to call functions during runtime, whose specific names are not known at compile time. A related use is also to implement function callbacks (i.e.: basically a mechanism by which a function can "callback" the function that called it in the 1st place).

3) manipulating arrays
This is actually similiar to point (1) above. Instead of passing around and manipulating the actual array elements, you pass around and manipulate them via the array pointer.

There are other great uses for pointers.

Hope that was useful to you.

Have fun! :)


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!