|
From: David M. <dml...@co...> - 2005-04-30 17:32:36
|
Yes there are a couple ways to do this. string array[5]; char * array[5]; char array[5] [MAX_STRING_LEN]; in the first and last method you can just go ahead and use the space without a need to allocate any memory. The third way is actually quite wasteful unless you know exactly how long the strings are. For the second you will have to do something like: array[1] = new char[length of sentence + 1]; array[1] = "sentence"; //Once you are done with the sentence delete [] array[1]; That leaves the first method which requires that you be using C++ and not C, the latter 2 methods work in C as well. Hope this helps David McKen Alexsandro Meireles wrote: > Hi, dev-c++ users! > > Do you know if it is possible to put sentences in an array in the > following way? > > array[0] = "sentence 1"; > array[1] = "sentence 2" > and so on... > > Any suggestion for this matter, i.e., to put sentences in a array? > > Tks in advance!!! > -- > Alexsandro Meireles |