;) Hello,
I have just started to learning C++. I have a question regarding a small code snippet that I am having trouble with. I get a compiler error saying that there is a parse error before the { token. Can anyone help me with this?
Thanks,
Navid
Here's the code:
#include <iostream>
using namespace std;
int main() {
struct CandyBar
{
string brand;
int calories;
float weight;
};
CandyBar *snack = new CandyBar[3];
snack[0] = {"Milky Way", 350, 2.3}; //**Error before { token
snack[1] = {"Hershey's", 400, 3.3};
snack[2] = {"Dove", 450, 4.3};
delete [] snack;
return 0;
}
;)