pointers
pointers
ok ive watched the lessons on pointers a couple times and i understand about they work as far as pointing to particular address in mem. im just get confused when it comes to actually using them
What you call a bug...I call a new feature!
Re: pointers
I would recommend that the best solution is to watch the videos again until you get pointers, or you can go to this website "Learncpp.com" and look to chapter 6, which looks at pointers directly. However I must say that it teaches pointers in a console project, maybe you can look at what the pointers do and then transfer the concept over to the graphical interface. The concept will remain the same, the only difference is the application of how it is used.
MOOOOOO
- npissoawsome
- Posts: 114
- Joined: June 8th, 2012, 3:01 pm
Re: pointers
well if I wanted to change the number of 3 vars I could write a function calledXxWalKaxX wrote:ok ive watched the lessons on pointers a couple times and i understand about they work as far as pointing to particular address in mem. im just get confused when it comes to actually using them
Code: Select all
void ChangeVar(*v1, *v2, *v3, num)
{
*v1 = num;
*v2 = num;
*v3 = num;
}
Code: Select all
int num1 = 0;
int num2 = 5;
int num3 = 3;
ChangeVar(&num1, &num2, &num3, 9);
cout << "Numbers are \nnum1: " << num1 << "\nnum2: " << num2 << "\nnum3: " << num3 << endl;
Code: Select all
Numbers are
num1: 9
num2: 9
num3: 9