Can anyone explain how this code doesn't give errors when compiled?
int main()
{
// why doesn't the following line give a type mismatch error??/
return "success!";
}
Because of the trigraph ??/, which is replaced by a \, meaning the return is commented out. Your code is equivalent to
int main()
{
// why doesn't the following line give a type mismatch error\
return "success!";
}
which is the same as
int main()
{
// why doesn't the following line give a type mismatch error return "success!";
}
Also note that, in the absence of a return statement in main, there is an implicit return 0;, so the code is well defined.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With