比如我定义了一个结构体
struct head
{
char s[10]
int n;
int i[20];
byte k;
byte b[50];
}
for(int x=0;x<5;x++)
{
printf();
//怎么填写
}
创建一个对象h,用h.xxx输出它的属性
#include <stdio.h>
#include <stdlib.h>
struct head
{
char s[10]="asd";
int n=1;
int i[20];
}h;
int main()
{
printf("%s",h.s);
return 0;
}
没有办法这样做。即使硬要这么做,也是得不偿失,需要绕很远去完成一件没有什麽意义的事。