C语言的:定义结构体和输出,怎么做?main()

来源:百度知道 编辑:UC知道 时间:2024/05/17 05:27:13
C语言的:定义结构体和输出,怎么做?main()
{
strcpy feng
{
int a;
char b;
}strcpy feng huo={97,'97'};
printf("d%c%"strcpy(huo.a),strcpy(huo.b));
}
帮我改一下

c语言中定义变量不能有空格,
结构的名称为strcut
strcpy 函数必须有两个参数
楼上的输出是正确的/

关键字是struct不是strcpy,
'97'这种写法也是错误的。
输出也写错了。
main()
{
struct feng
{
int a;
char b;
};
struct feng huo={97,97};
printf("%d %c ",huo.a,huo.b);
}

#include <stdio.h>

struct feng
{
int a;
char b;
}huo={97,'97'};
main()
{
printf("d%\nc%\n",huo.a,huo.b);
}

#include <stdio.h>

struct feng
{
int a;
char b;
}huo={97,'97'};
main()
{
printf("d%\nc%\n",huo.a,huo.b);
}
这种方法是正确的。

朋友,你学C的时候至少要有一本C语言教程书你提的这个问题上面都有,这不是个很难的问题,你翻书看就知道了,但它不一定的篇幅,在这里打出来要一点时间所以你可以直接到书里去学,没书的话你就到新华书店里看.一看就会

结构在main函数外面定义