-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path9pointers.cpp
More file actions
23 lines (20 loc) · 860 Bytes
/
Copy path9pointers.cpp
File metadata and controls
23 lines (20 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include<iostream>
using namespace std;
int main(){
//pointers --> pointers are variables or datatypes that tell the address or point to the address of another variable or datatypes
int a = 3;
int *b = &a;
// & is called the address-off operator that tells the address of the datatype
cout<<"The address of a is "<<&a<<endl;
cout<<"The address of a is "<<b<<endl;
// * is called the dereference operator that tells the value of the pointer or the value of the
//datatype that the pointer is holding (value at)
cout<<"The value stored at address b is "<<*b<<endl;
//pointer to pointer
int **c = &b;
cout<<"The address of b is "<<&b<<endl;
cout<<"The address of b is "<<c<<endl;
cout<<"The value at address c is "<<*c<<endl;
cout<<"The value at address (value at c) is "<<**c<<endl;
return 0;
}