Oh, sorry, it's 3:30 AM.. I can't think straight right now.
I know what you mean... Earlier in the day I'm nice... then at night I can be a bit of a b****
Originally Posted by Koreans
They are good for indirectly accessing things
which would be helpful how?
Originally Posted by VvITylerIvV
I know what you mean... Earlier in the day I'm nice... then at night I can be a bit of a b****
which would be helpful how?
They are just beneficial. Programming pretty much needs pointers. Just read more on it because i dont want to explain
Originally Posted by Koreans
They are just beneficial. Programming pretty much needs pointers. Just read more on it because i dont want to explain
Well then don't explain, I've re-read the entire pointers section multiple times... I can't see how they would benefit me. I'll wait for somebody else to explain it to me. It's not that important at the moment so I don't really care. But thats why I asked it now, not when it would be important see I can halfthink while I'm halfasleep.
Ill explain a few reasons.
1.Accessing class member data
2.Accessing data on the free store
3.Passing variables by reference to functions
Originally Posted by Koreans
Ill explain a few reasons.
1.Accessing class member data
2.Accessing data on the free store
3.Passing variables by reference to functions
oh, thanks (just learning about classes... I guess you started learning a few days before me)
Originally Posted by VvITylerIvV
oh, thanks (just learning about classes... I guess you started learning a few days before me)
Whenn you learn about polymorphism, youll use them a lot more
You point at say, the game's HEALTH variable. You tell your program to change it to 100.
That's an example.
Originally Posted by freedompeace
You point at say, the game's HEALTH variable. You tell your program to change it to 100.
That's an example.
pointers are not necessarily used for hacking.. and its called pointer because in that case it is pointing to the memory address (ex: 0x0001337) which contains in it the value of health.
Pointer is just a way of getting access to memory without using the variable it self.. in programming a common way of using that is by changing a var value without actually using it, all this by using it's reference. (address)
edit:
a good example here:
[php]#include <iostream>
using namespace std;
void person(int *age) // *age is a pointer
{
*age = 20; //pointing to personAge
}
int main()
{
int personAge;
person(&personAge); //this is passing var reference
cout << personAge;
return 0;
}[/php]
output:
Code:
20
Originally Posted by Brinuz
pointers are not necessarily used for hacking.. and its called pointer because in that case it is pointing to the memory address (ex: 0x0001337) which contains in it the value of health.
Pointer is just a way of getting access to memory without using the variable it self.. in programming a common way of using that is by changing a var value without actually using it, all this by using it's reference. (address)
edit:
a good example here:
[php]#include <iostream>
using namespace std;
void person(int *age) // *age is a pointer
{
*age = 20; //pointing to personAge
}
int main()
{
int personAge;
person(&personAge); //this is passing var reference
cout << personAge;
return 0;
}[/php]
output:
Code:
20
OK... so indirect access would be helpful when I am using a function and require the function to change the value of the variable?
Originally Posted by VvITylerIvV
OK... so indirect access would be helpful when I am using a function and require the function to change the value of the variable?
yea (e.g)... without needing to return (attention that arrays wont need it.. for the reason already talked about on the other topic)