<分区>
我的结构:
typedef struct{
int parking_id;
}info;
在main()
int lot_number[6]={100,101,102,103,104,105}
lot_number
( 100, 101 to 105 ) 数组的值基本上就是parking_id
,如何匹配呢?用指针?
<分区>
我的结构:
typedef struct{
int parking_id;
}info;
在main()
int lot_number[6]={100,101,102,103,104,105}
lot_number
( 100, 101 to 105 ) 数组的值基本上就是parking_id
,如何匹配呢?用指针?
最佳答案
引用 C11
,第 6.7.9 章
[...] the initializer for an object that has aggregate or union type shall be a brace-enclosed list of initializers for the elements or named members.
您可以简单地使用初始化列表,如
info lot_number[6]={{100},{101},{102},{103},{104},{105}};
关于c - 使用结构搜索并匹配数组元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37352519/