#define MAX 10
struct setArray
{
int item[MAX];
int count;
};
typedef struct setArray *BitSet;
我应该如何åˆå§‹åŒ–结构ä¸çš„å…ƒç´ ï¼Ÿ
ç”案 0 :(得分:2)
例如
struct setArray s = { { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, MAX };
或
struct setArray s;
for ( int i = 0; i < MAX; i++ ) s.item[i] = i;
s.count = MAX;
或者
BitSet p = malloc( sizeof( *p ) );
for ( int i = 0; i < MAX; i++ ) p->item[i] = i;
p->count = MAX;