1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 void test(char *tmp)
6 {
7 char *p = (char *)malloc(15);
8 memcpy(tmp, &p, sizeof(char **));
9 printf("1.%p\n", p);
10 }
11
12 int main()
13 {
14 char p[32];
15 char *p1;
16 test(p);
17 p1 = *(char **)p;
18
19 printf("2.%p\n", p1);
20
21 }
2 #include <stdlib.h>
3 #include <string.h>
4
5 void test(char *tmp)
6 {
7 char *p = (char *)malloc(15);
8 memcpy(tmp, &p, sizeof(char **));
9 printf("1.%p\n", p);
10 }
11
12 int main()
13 {
14 char p[32];
15 char *p1;
16 test(p);
17 p1 = *(char **)p;
18
19 printf("2.%p\n", p1);
20
21 }