pointer
Sep 28, 2015 at 2:34am
can pointer point to 2 variables at one time?
Sep 28, 2015 at 2:39am
No, a pointer can only point to one location at a time.
Sep 28, 2015 at 9:13am
Put this 2 variables in a struct.
Sep 28, 2015 at 9:26am
Or into an array, if the variables have same type.
A pointer is a variable that holds one numeric value. The value is interpreted as a memory address.
Sep 29, 2015 at 12:53pm
like @coder777 said make a simple struct like so :
1 2 3 4 5 6 7 8 9 10 11 12 13
|
struct Structure
{
int var1;
int var2;
} *pointer;
int main()
{
pointer = new Structure(1,2);
cout << pointer << endl;
cout << pointer->var1 << endl;
cout << pointer->var2 << endl;
return 0;
|
}
Topic archived. No new replies allowed.