Struct problem -- yes I read the manual and the Bfaq

Started by Bleckman1974, Fri 07/04/2006 13:29:23

Previous topic - Next topic

Bleckman1974

ok, I searched and read the manual

I did what it said to do:

struct Weapon {
  int damage;
  int price;
  String name;
};
Weapon sword;
sword.damage = 10;
sword.price = 50;
sword.name = "Fine sword";

And then did the rest
why does it say unexepted "sword?"


Narcolepsy (BACK IN PRODUCTION)
Story (50%)
Graphics (5%)
Puzzles(20%)
Programming(15%)

Still Reading Commercial Emails For Free?
Receive Emails On Topics That Interests You
And Get Paid For It! Get $10 Just to signup!
http://hits4pay.com/members/index.cgi?bleckman1974

Gilbert

Assigning values to struct members MUST be within functions, so move the "sword.=*;" lines into a function to initialise teh values.

Bleckman1974

Narcolepsy (BACK IN PRODUCTION)
Story (50%)
Graphics (5%)
Puzzles(20%)
Programming(15%)

Still Reading Commercial Emails For Free?
Receive Emails On Topics That Interests You
And Get Paid For It! Get $10 Just to signup!
http://hits4pay.com/members/index.cgi?bleckman1974

SMF spam blocked by CleanTalk