This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

my compiler gives syntax errors while initializing structures.help!

when i write this:

#include<iostream.h>
struct cards
{ char loc[21]; int pay; int rent;
};
void main()
{ cards p; p.loc={"samantha"}; cout<<p.loc;
} my compiler gives this error:

Compiling...
fdv.cpp
D:\Visual C++6\MSDev98\MyProjects\ADV\fdv.cpp(11) : error C2059: syntax error : '{'
D:\Visual C++6\MSDev98\MyProjects\ADV\fdv.cpp(11) : error C2143: syntax error : missing ';' before '{'
D:\Visual C++6\MSDev98\MyProjects\ADV\fdv.cpp(11) : error C2143: syntax error : missing ';' before '}'
Error executing cl.exe.

ADV.exe - 3 error(s), 0 warning(s)
please help.this is exactly how my mam told us,i dont know what to do..got a proj up in 3 days!!any help at all will be welcome.

Parents Reply Children