-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtcharstarstararray.c
44 lines (33 loc) · 964 Bytes
/
tcharstarstararray.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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void);
int
main(void)
{
unsigned int count = 2;
char **ptr;
char *res_storage[10];
char **res = res_storage;
printf("sizeof(void *) = %d\n\n", (int) sizeof(void *));
printf("res = %p\n", res);
printf("res +% 2d = %p\n", count, res+count);
printf("res[%d] = %p\n", count, &res[count]);
printf("storage = %p\n\n", &res_storage[count]);
ptr = (char **) (void **) &res[count];
printf("ptr = %p\n", ptr);
ptr = (char **) &res[count];
printf("ptr = %p\n", ptr);
ptr = &res[count];
printf("ptr = %p\n", ptr);
exit(0);
/* NOTREACHED */
}
/*
* CPPFLAGS='-fstrict-aliasing -Wstrict-aliasing=1'
*
* Local Variables:
* eval: (make-local-variable 'compile-command)
* compile-command: (let ((fn (file-name-sans-extension (file-name-nondirectory (buffer-file-name))))) (concat "rm -f " fn "; " (default-value 'compile-command) " " fn " && ./" fn))
* End:
*/