我在'testFunction(45,UP)'行看到“字符串常量之前的语法错误”
#define UP "UP\0"
#define DOWN "DOWN\0"
#define testFunction(intensity, direction) \
{ \
.force = intensity, \
.direction = direction, \
}
struct configureObject {
int force;
char direction[7];
};
static const struct configureObject configureFiles[] =
{
testFunction(45, UP),
testFunction(46, DOWN),
};
在主()
printf("force: %d\n", configureFiles[0].force);
printf("direction: %s\n", configureFiles[0].direction);
printf("force: %d\n", configureFiles[1].force);
printf("direction: %s\n", configureFiles[1].direction);
没有其他编译器提示。这个错误的原因可能是什么?谢谢你。