Code:
struct ship
{
char name[20];
int hull;
int shields;
int torp_str;
int phaser_str;
} standard, current, created;;
standard.name = "Standard"; //error occurs on this line
standard.hull = 100; //this line
standard.shields = 100; //and this one
standard.torp_str = 20; //this one....
standard.phaser_str = 40; //and finally this one
There's the code of the structure and the declarations. The error displayed is this:
Code:
expected constructor, destructor, or type conversion before '.' token
and this
Code:
expected `,' or `;' before '.' token
at the four lines that are commented.
I don't understand though why strcpy() would work any better than just what I have for the character array since with non-structured variables you can store words in them in the same manner.