能简单的举个例子吗? 拜托啦
追答1、直接初始化
struct student
{
char a[2][2]={{a,b},{c,d}};
};
2、利用成员运算符访问对其进行初始化
struct student
{
char a[2][2];
}stu;
stu.a[2][2]={{a,b},{c,d}};
3、利用指针访问对其初始化
struct student
{
char a[2][2];
}stu;
student *p=&stu;
p->a[2][2]={{a,b},{c,d}};或者(*p).a[2][2]={{a,b},{c,d}};
明白了吧。。。有什么不清楚的地方欢迎追问。。。
struct Martrix
{
char data[5][4];
}mart;
void main()
{
mart mart1;
mart1.data[5][4]={{' ',' ',' ','*'},{' ',' ',' ','*'},{' ',' ',' ','*'},{' ',' ',' ','*'},{' ',' ',' ','*'}};
}
这个错在哪? 这是程序的一部分 谢谢啦