数据结构(C语言)strcpy()函数

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
struct stu{
int sno;
char name[10];
};
int main(int argc, char *argv[]) {
struct stu s1,s2;
s1.sno=01;
strcpy(s1.name,"abc");    //字符串只能这样输出
s2=s1;
printf("sno:%d,name:%s\n",s1.sno,s1.name);
printf("sno:%d,name:%s\n",s2.sno,s2.name);
return 0;
}

posted @ 2022-03-04 19:41  小尹将接受小王的崇拜  阅读(91)  评论(0)    收藏  举报