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() {
int pause;
struct Customer {
int uid;
string name;
};
Customer customerRecords[2];
customerRecords[0] = {25, "Bob Jones"};
customerRecords[1] = {26, "Jim Smith"};
cin >> pause;
return 0;
}
Try this: