lundi 24 mai 2021

"initializer element is not constant" error in C

I want to create a dynamic name for one project. For that, I need to pass macro #define PROJECT_NAME "Project Name" . To create the dynamic name I wrote one function which returns the dynamic name of the project.

const char *get_DynamicName()
{
    //create the dynamic name
    return name;

}

and then I m passing this function to macro #define PROJECT_NAME get_DynamicName(). But I m getting the " error: initializer element is not constant". But as we can see I m passing the function which returns the const char.

Aucun commentaire:

Enregistrer un commentaire