这是struct
我所拥有的:
typedef struct
{
float r, g, b;
} color_t;
我想将 this 的复合文字struct
作为参数传递给函数,如下所示:
void printcolor(color_t c)
{
printf("color is : %f %f %f\n", c.r, c.g, c.b);
}
printcolor({1.0f, 0.6f, 0.8f});
但是,这给了我一个错误:
错误:“{”标记之前的预期表达式