70,037
社区成员
发帖
与我相关
我的任务
分享
struct A
{
char *str;
};
typedef struct A TypeA
void fun(void *p)
{
TypeA b;
b.str = "Turn";
memcpy((unsigned char*)p,¶m,sizeof(TypeA));
}
#include <stdio.h>
#include <string.h>
struct A
{
char *str;
};
typedef struct A TypeA;
void fun(void *p)
{
TypeA b;
unsigned char *temp = (unsigned char*)p;
b.str = "Turn";
memcpy(temp, b.str, strlen(b.str));
temp[strlen(b.str)] = 0;
}
main()
{
unsigned char dst[32];
fun(dst);
printf("%s\n", dst);
}