Skip to main content
Arduino

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Use chars in quotes in const char* as name of function

I have been trying for a long time how to use a word declared as const string* word = "xxx" as name of void function declared somewhere below in my code.

Here is example with ssid:

const char* ssid = "name_of_ssid";
void (*name of ssid*) () {
⠀//some code
}

I want to use word declared in const char* in quotation marks as name of function. It can not be written just void ssid(). Yes, I can set a name of void function manually, when const char* ssid = "CoffeeWifi" I can type void CaffeeWifi() but I want to do that by this way because my code is specific for this option and explaining this code here would be very difficult. When I change array of const char* word from "xxx" to "yyy" I want to change the name of void from void xxx() to void yyy() as well.

How to do that? What function should I use?

Thank you!

Answer*

Draft saved
Draft discarded
Cancel

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /