-
Notifications
You must be signed in to change notification settings - Fork 8
/
setimo.cpp
46 lines (35 loc) · 847 Bytes
/
setimo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <cstddef>
using namespace std;
//Ponteiros
int main(){
int var1;
int* pont1;
var1=5;
pont1=&var1;
cout << "Valor da variavel, atraves do seu nome: " << var1 << endl;
cout << "Endereca armazenado no ponteiro: " << pont1 << endl;
cout << "Valor da variavel, atraves do ponteiro: " << *pont1 << endl;
int var2;
//var2 = var1;
//var2 = *pont1;
//cout << var2;
//var1=30;
//*pont1 = 30;
//cout << var1;
var2 = 50;
//pont1 = &var2;
//cout << *pont1 << endl;
//cout << var1;
//int* pont2;
//pont2 = NULL;
//cout << *pont2;
int* pont3 = new int;
*pont3 = 35;
//cout << *pont3;
//*pont3 = *pont1;
delete pont3;
pont3 = pont1;
cout << *pont3;
return 0;
}