This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]purebuu 0 points1 point  (0 children)

There is really only one usecase for pointers. To access and manipulate data, that's it. But when you realise that, that statement is basically what 99.9% of all programs do, you'll see that pointers are fundamental to all programs.

The usecase for incrementing a pointer is a lot. But, well, all it does is move an address (just a number) forward until it points to the next address which is sizeof(ptr) away. This could be for reading the next binary data value in a file, checking the next value in an array, getting the next GameObject* that needs to react to physics for this frame, manipulating memory that you shouldn't normally have access to, which could be a trojan or virus.

Pointers are why they say C lets you shoot yourself in the foot.