We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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.
Keil is a company that - among other things - sells compilers for microcontrollers used in embedded equipment.
You have to write strcpy(p.loc,"samantha"); if trying to assign a value after the variable have already been created.
Another alternative would have been to write: cards p = { "samantha" };
thankyou sir-thankyou so much!!!u have been great help!i assume i must not bother you again with questions about c++ programming,right?...or can i ask programming related questions on your page?? thanks again.
This is not my page. This is Keil's page. But it is a forum for Keil end users, so we who do read and write here are (normally) users of Keil compilers and/or Keil development kits.
okay!i have also got answers from other people on other websites but yours has been most helpful. thanx again!