see topic
see topic
Well, pointers have a number of useful applications.
Firstly, a number of things you do all the time use pointers, even if you are not aware. A struct is a pointer. An array is a pointer. A string is a pointer. A class is a pointer. There is no way of representing a number of associated objects without using pointers in some form or another.
Also, pointers are useful for efficiency. If you pass ten thousand ints to a function, you will have a substantial time penalty, unless you pass a pointer to an array of ten thousand ints.
Look into linked lists. Yeah pointers do look pointless at first, but they do have uses.
or probaly most important is its the only way to use the "freestore". This will solve your problem of needing a variable in 2 functions but don't want to make it global.
"Christ died for our sins. Dare we make his martyrdom meaningless by not committing them?"