一个函数怎么带出去自己的地址

来源:互联网 发布:呱呱麻将作弊软件 编辑:程序博客网 时间:2024/06/03 02:18
  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 }           
原创粉丝点击