I am under the the impression that a variable is what is stored in a memory
address and a pointer is the memory address of the variable?
I was looking to use a function that does not return a value void
whatever(whatev er) and not have a variable global but in main and change the
value in the void whatever function.
using namespace std;
void whatever(int);
int main()
{
int test;
test = 1;
whatever(test);
return 1;
}
void whatever(int testing)
{
&test = testing
// The above line I am unsure of how to exactly do it.
//what would I need to change in order to change the
//value of test in main though the whatever function
//without actually having to return a value.
}
Thank you,
Shawn Mulligan
address and a pointer is the memory address of the variable?
I was looking to use a function that does not return a value void
whatever(whatev er) and not have a variable global but in main and change the
value in the void whatever function.
using namespace std;
void whatever(int);
int main()
{
int test;
test = 1;
whatever(test);
return 1;
}
void whatever(int testing)
{
&test = testing
// The above line I am unsure of how to exactly do it.
//what would I need to change in order to change the
//value of test in main though the whatever function
//without actually having to return a value.
}
Thank you,
Shawn Mulligan
Comment