Why do I get “ stray '#' in program ” error? I am making an Arduino program with SIM800L module and would like to check credit status of the SIM card.
When I manually enter the command: AT+CUSD=1,"*123#" into Serial Monitor, it works fine.

But in the Arduino (1.8.7) I am receiving an error 
      stray  "#" in program

when compiling this line of sketch:
      SIM800.print("AT+CUSD=1,"*123#"\r");

I am not experienced enough to fix this problem.
Could somebody help me, please?

Thank you.
Marko
Use the escape backslash to get a double quote in a text. See: https://en.cppreference.com/w/cpp/language/escape

Is the *123$ between double quotes?

Serial.println("Hello");
Serial.println("I said: Hello to you");
Serial.println("I said: \"Hello\" to you");
Serial.println("AT+CUSD=1,\"*123#\"\r");
Serial.println("AT+CUSD=1,\"*123#\"");


I think the carriage return \r at the end is not needed when the println is used. The println adds a linefeed \n by the way.