I have here char text[60];
Then I do in an if:
if(number == 2)
text = "awesome";
else
text = "you fail";
and it always said expression must be a modifiable L-value.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
lvaluemeans "left value" — it should be assignable. You cannot change the value oftextsince it is an array, not a pointer.Either declare it as char pointer (in this case it’s better to declare it as
const char*):Or use strcpy: