Accidentally converting string constant to char*

Hi, I’m getting a warning when I compile for this line:

char* cellNumber= {"+12345678901"};

The warning says:
ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

What Can I do to clear this? I use this variable to send a text message via twilio.
The message gets thru, but I’m trying to clear the warnings out of my code…

You could make cellNumber constant:

const char* cellNumber = "+12345678901";
2 Likes

Thanks, worked! I definitely don’t have a well founded knowledge of how variables work.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.