int main(void) {
char testStr[50] = "Hello, world!";
char revS[50] = testStr;
}
I get error: “invalid initializer” on the line with revS. What am I doing wrong?
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.
You can’t initialise
revSin that manner, you need a very specific thing to the right of the=. FromC11 6.7.9 Initialization /14, /16:To achieve the same result, you could replace your code with:
That’s not technically initialisation but achieves the same functional result. If you really want initialisation, you can use something like: