خرید بک لینک

Vote count: 0

I have:

typedef struct { int aaa; int bbb; } My_Struct;

And I want to make a constant script for a regression test that contains multiple copies of My_Struct with initialized values, but also with the labels (aaa & bbb) for readability and convenience. I can't figure out the syntax, or if this is even possible in C.

The closest I can get it is this:

struct {

struct { int aaa = 111; int bbb = 222; } first_script;

struct { int aaa = 333; int bbb = 444; } second_script;

} const my_script_array;

But how do I define my_script_array to be an array of type My_Struct so that I don't have to cast it (My_Struct)my_script_array in the code?

asked 32 secs ago

- - , .
.

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 22 تير 1395 ساعت: 22:14

صفحه بندی