Address Operator : it shows where in the memory the variable is stored
#include <iostream>
int main()
{
using namespace std;
int f = 10; //make variables
int e = 2;
//output on the screen?
cout<< f << endl;
cout<< &f <<endl; //address where the variable is located in the memory(HexDecimal location)
cout<< e <<endl;
cout << &e <<endl;
system("pause");
return 0;
}
===> useful for pointer
Pointer : variable that holds an address of your memory
int main()
{
int f = 10;
int e = 2;
//pointer and stored var should have same type
int *pointer; //what address??
//have to answer it..
pointer = $f;
cout<<pointer<<endl; //address of memory(point the space of your memory where the f is..)
return 0;
}
'Computer General > C++ development from the beginning' 카테고리의 다른 글
| Logical OR operator (0) | 2014.12.16 |
|---|---|
| The if Statement (0) | 2014.12.12 |
| Beginning Loop (0) | 2014.12.12 |
| Beginning Arrays (0) | 2014.12.12 |
| User Defined Functions (0) | 2014.12.12 |