+ 3

Which Code is Useful For Understanding The Concept Of pointers?

Thanks In Advance :)

1st Jan 2017, 4:23 PM
Shivam Negi
Shivam Negi - avatar
1 Resposta
+ 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.
1st Jan 2017, 4:49 PM
Hatsy Rei
Hatsy Rei - avatar