Stumbled on this row of c code but was unsure if it is valid or not. What does it do? What type will the variable have?
const VARNAME = "String of text";
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.
Curiously, I wasn’t expecting this to compile, but it does. However, compiler doesn’t like it too much:
So it does take int as default type, and thus VARNAME has a pointer value, since a string is a pointer (which later could be cast as char*).
This works perfectly (on a Intel IA32 machine):
But I personally wouldn’t use such implicit typing. As explained on the comments below: