I want to declare an array of type (char / string) confused! dunno which one.. which will store 5 names
this code couldnt work
char names[5]={monitor,cpu,mouse,joystick,system};
someone guide me please

My recommendation would be to use the string class:

string names[] = {"monitor", "cpu", "mouse", "joystick", "system"};

The problem with your code is that the "strings" aren't string literals, so they're treated as identifiers that don't exist. Further, the type of your array is char, which means each element of the array can hold one character and no more.

To hold multiple characters, the type of the array needs to be a char* that points to a string literal or dynamic memory, an array of char (ie. a 2D array), or an array of std::string as in my example above. The latter provides the most flexibility by far, and that's why it's recommended.

commented: thank you it worked perfectly +0