creating an array of structs in c++

后端 未结 4 1327
谎友^
谎友^ 2021-01-31 18:21

I\'m trying to create an array of structs. Is the code below valid? I keep getting an expected primary-expression before \'{\' token error.

int main         


        
4条回答
  •  北海茫月
    2021-01-31 18:31

    Try this:

    Customer customerRecords[2] = {{25, "Bob Jones"},
                                   {26, "Jim Smith"}};
    

提交回复
热议问题