Could any one help me with a problem with my code i cant see. I have an array of string i want to be displayed. a variable that increaments and decreaments and want the string passed to the function. The problem is the Whole string i want is not being passed though
i.e. ucMainMenu = 1 MenuString[1] = “TIME” DisplayString(“TIME”)
const char MenuString[6][8] = {"UNITS", "TIME", "DATE", "PRINT", "BTOOTH", "SERVICE"};
void main
{
ucMainMenu++; //variable changing
DisplayString(MenuString[ucMainMenu]); //look up variable in array pass string to function
}
void DisplayString(char *cDisplayString)
{
//do stuff with string
}
Try this:
Read about initialization in C here
Hope it helps!