typedef struct {
int a[3][2];
int b[2][3];
} book;
book bk =
{
1,2,
3,4,
5,6,
1,2,3,
4,5,6
};
int main()
{
printf("bk.a[0][1]= %d. \n", bk.a[0][1]);
return 0;
test.c
========================================================
#include <stdio.h>
#include "test.h"typedef struct {
int a[3][2];
int b[2][3];
} book;
book bk =
{
1,2,
3,4,
5,6,
1,2,3,
4,5,6
};
int main()
{
printf("bk.a[0][1]= %d. \n", bk.a[0][1]);
return 0;
}
test.h
=====================================================
1. 这种方式可以
#define ABC \
1,2, \
3,4, \
5,6 \
#define DEF \
1, 2, 3, \
4, 5, 6
2. 这种方式也可以
#define ABC \
1,2, \
3,4, \
5,6
#define DEF \
1, 2, 3, \
4, 5, 6
3. 这种方式不行
#define ABC \
1,2, \
3,4, \
5,6 \
#define DEF \
1, 2, 3, \
4, 5, 6
原因在于5,6 的"\" 表示连接后面的数或者符号。
本文深入解析了C语言中结构体的定义与应用,以及预定义宏的使用技巧,通过实例展示了如何高效地管理和操作复杂数据类型。
2087

被折叠的 条评论
为什么被折叠?



