strcpy 是在string.h 里面
#include "stdafx.h"
#include "string.h"
struct Student
{
int Sex;
char name[10];
short b;
};
int main(int argc, char* argv[])
{
Student aa;
strcpy(aa.name,"shusheng");
printf("%x\n",sizeof(aa));
return 0;
}
非常快的放入数据
定义结构体的好处
#include "stdafx.h"
#include "string.h"
struct Student
{
int a;
char name[10];
short number;
};
int main(int argc, char* argv[])
{
Student aa[10];
strcpy(aa[0].name,"shusheng");
aa[0].a=20;
aa[0].number=10;
strcpy(aa[1].name,"xueshen");
aa[1].a=10;
aa[1].number=20;
printf("%x\n",sizeof(aa));
return 0;
}