-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestPunteros.c
91 lines (48 loc) · 981 Bytes
/
testPunteros.c
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <stdio.h>
#include <stdlib.h>
typedef struct _cola {
int h;
int *sig;
} cola;
void f() {
int num = 4;
int num2 = 56;
int *p;
printf("Sizeof1: %zu\n", sizeof(*p));
p = #
printf("Sizeof2: %zu\n", sizeof(*p));
printf("Direccion Poniter: %p\n", &p);
printf("Direccion: %p\n", p);
printf("Valor: %d\n", *p);
*p = num2;
printf("Direccion: %p\n", p);
printf("Valor num2: %d\n", *p);
printf("Valir num: %d\n", num);
}
void f2() {
cola *c2 = (cola*)calloc(1, sizeof(cola));
c2 = NULL;
if (c2) {
printf("hola\n");
}else{
printf("adios\n");
}
}
int main(int argc, char const *argv[])
{
int var = 8;
cola *c;
//cola *c = (cola*)malloc(sizeof(cola));
printf("Sizeof: %zu\n", sizeof(*c));
printf("SIZEOF: %zu\n", sizeof(cola));
f();
c->h = 5;
c->sig = &var;
printf("jbdfsjfbjds: \n");
*(c->sig) = 9;
printf("dsfds\n");
printf("C.h: %d\n", c->h);
printf("C.sig: %d\n", *c->sig);
f2();
return 0;
}