-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathptr.c
50 lines (37 loc) · 932 Bytes
/
ptr.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
#include <stdio.h>
typedef struct s_struct
{
char *test1;
int test2;
} t_struct;
int main(void)
{
void *tmp;
char *douze = "12";
int *undeux = (int [2]){1, 2};
t_struct *unetdeux = (t_struct[2]){{"1", 1},{"2", 2}};
printf("CHAR\n\n\n");
printf("sizeof(char) = %zu\n\n", sizeof(char));
tmp = douze;
printf("ptr value case 0 = %d\n", (int)tmp);
douze++;
tmp = douze;
printf("ptr value case 1 = %d\n", (int)tmp);
printf("\n\n\n\n");
printf("INT\n\n\n");
printf("sizeof(int) = %zu\n\n", sizeof(int));
tmp = undeux;
printf("ptr value case 0 = %d\n", (int)tmp);
undeux++;
tmp = undeux;
printf("ptr value case 1 = %d\n", (int)tmp);
printf("\n\n\n\n");
printf("STRUCT\n\n\n");
printf("sizeof(t_struct) = %zu\n\n", sizeof(t_struct));
tmp = unetdeux;
printf("ptr hexa value case 0 = %d\n", (int)tmp);
unetdeux++;
tmp = unetdeux;
printf("ptr hexa value case 1 = %d\n", (int)tmp);
return (0);
}