7 Years
Discussion Span
Last Post by LordNemrod

It's just a multi-dimensional array of char...

//an array of char
char charArray[80];

//an array of char*
char* charpArray[80];
//an array of arrays of char
char mdCharArray[25][80]; //25 80-char arrays

It's exactly like the main() parameter char *argv[] (which is another way to do it)

Or did you mean something else?

Edited by Fbody: n/a


To tell you the truth i need something like:

char* months[] = {"january","february","march","april"};

But i get thi warnings:warning: deprecated conversion from string constant to ‘char*’


Hmm....I don't get that warning.

Are you using/compiling as C++ 0x? I wonder if that's something that comes from the new draft...

Edited by Fbody: n/a


> deprecated conversion from string constant to ‘char*’

The string literals are constants, so using const is in order, like so

const char * months[] = {"january","february","march","april"};

pointer to array of character strings... If by character string you mean const char*, and if you MEAN you want to declare a pointer to array of pointers to const char(which I doubt), then it will be like this

typedef const char * str_type;
typedef str_type arr_type[100];
typedef arr_type* my_desired_type;

my_desired_type var; //var is a pointer to array of pointers to const char

Or, the same without the typedefs will be

const char * (*var)[100];
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.