0
点赞
收藏
分享

微信扫一扫

memcpy的用法实例

zhoulujun 2022-09-16 阅读 175


#include <stdio.h>                                                                                                                         
#include <string.h>

char*
copy_string(char *string)
{
//static char tmp[20];
static char *temp;
memcpy(&temp,&string,10);
//memcpy(temp,string,10);
//memcpy(*temp,*string,10);

return temp;
}

int
main()
{
char *show,*result;
show="haha show";
result="test";
printf("show point to address : %p\n",show);
printf("result point to address : %p\n",result);
result = copy_string(show);
printf("***result string : %s\n",result);
printf("show point to address : %p\n",show);
printf("result point to address : %p\n",result);

return 0;
}

 

举报

相关推荐

0 条评论