Missing the */ from a "comment" in a string

While compiling a sketch with a string containing the sequence "/*", I noticed the compiler thinks this is also a start of a comment block and thus expects me to end it. Good thing the string is still compiled correctly.

Here is the relevant line:

char morseTable[] = "*5*H*4*S***V*3*I***F***U?*_**2*E***L\"**R*+.****A***P@**W***J'1* *6-B*=*D*[glow]/*[/glow]X***N***C;*!K*()Y***T*7*Z**,G***Q***M:8*****O*9***0*";

The compilers error message is:

Missing the / from the end of a / comment /*

Luckily, one can end the "comment" in a comment line to keep it happy:

// */

I just thought someone should know.

The forward slash has specific meaning in C. If it is to be included in a string literal, it should be escaped (preceded with a ).

This should also work...

char morseTable[] = "*5*H*4*S***V*3*I***F***U?*_**2*E***L\"**R*+.****A***P@**W***J'1* *6-B*=*D*/[glow]" "[/glow]*X***N***C;*!K*()Y***T*7*Z**,G***Q***M:8*****O*9***0*";

PaulS:

Ah I didn't think about that, even if I used it in the same string earlier for escaping the quotation mark. But it didn't work, strange enough. Still the same complaint about the missing */. As a test I tried preceding it with another slash // instead of a backslash /, but the byte size became different so I'm guessing the string got longer.

Coding Badly: Brilliant! That worked!