+ 2
Invalid suffix literal error!
#include <iostream> using namespace std; int main() { cout << "Hello world! \"<< "I love programming!"; return 0; } The above code compilation throws an error - "invalid suffix literal" what does that indicate?
4 Answers
+ 9
because you use \" and that means that " will be considered as " character and not enclosing string character so you didn't close string then
+ 5
\ "
i.e. A space between \ and " escapes the whitespace and not the ". Hence, there is no error.
+ 1
However,
"Hello World! \ "
doesn't throw an error.
\ followed by a space and then " works fine. Error occurs only when there is no space.
0
thanks guys!