+ 3
Which Code is Useful For Understanding The Concept Of pointers?
Thanks In Advance :)
1 Answer
+ 9
#include <iostream>
using namespace std;
int main()
{
int x = 1;
int *y;
y = &x;
cout << x << endl;
cout << *y << endl;
cout << &x << endl;
cout << y << endl;
cout << *&x << endl;
return 0;
}
To make things easier:
'*' symbol is the 'point-to' operator.
'&' symbol is the 'address-of' operator.
Try compiling the code for output and rereading the code with these definitions and you should have a better understanding of pointers.