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
It works perfectly. I have gcc compiler C++11 ready. Try this and you'll see:
#include
using namespace std;
int main()
{
int pause;
struct Customer
{
int uid;
string name;
};
Customer customerRecords[2];
customerRecords[0] = {25, "Bob Jones"};
customerRecords[1] = {26, "Jim Smith"};
cout << customerRecords[0].uid << " " << customerRecords[0].name << endl;
cout << customerRecords[1].uid << " " << customerRecords[1].name << endl;
cin >> pause;
return 0;
}