Is it appropriate to set a value to a "const char *" in the header file
- by sud
I have seen people using 2 methods to declare and define char *
Medhod-1: The header file has the below
const char* COUNTRY_NAME_USA = "USA";
Medhod-2:
The header file has the below declaration
const char* COUNTRY_NAME_USA;
The cpp file has the below defintion :
const char* COUNTRY_NAME_USA = "USA";
Is method-2 wrong in some way ?
What is the difference between the two ?
I understand the difference between "const char * const var" , and "const char * var". If in the above methods if a "const char * const var" is declared and defined in the header as in method 1 will it make sense ?