char *text[] = {
"message0",
"message1",
"message2"
};
can also use char near *text[], char far *text[], char huge *text[].
has to have an asterisk pointer to display each element of the char array.
for loop example to display text:
char i; // int type can also be used
for (i = 0, i < 3; i++)
printf("%s\n", text[i]);
while loop example:
char i = 0; // may not be zero when declared as "char i;" only
while (i < 3) {
printf("%s\n", text[i]);
i++;
}
dowhile loop example:
char i = 0; // may not be zero when declared as "char i;" only
do {
printf("%s\n", text[i]);
i++;
} while (i < 3);
1) This will soon get washed off from 1st page and nobody will see it
2) can also use char near *text[], char far *text[], char huge *text[]. you can't. At least in standard C++.
3) It is constchar* []. Get const-correctness right!
about 2)
maybe newer programming languages set the memory size with "char *name[]" automatic.
in the dos language near, far, and huge are specifiable. near is 16-bit, far and huge are 32-bit.
about 3)
maybe "const char*" is necessary in your programming language.
for the dos language, const means the text won't change, but isn't really necessary
since the text isn't modified by a loop. so the format i list is correct.
you didn't list a name for the char array as "const char* []"
char is a keyword and isn't enough.
There is no dos language.
different kids of pointers are unstandard extension for segmented memory model in C. There is noo such keywords in C++
maybe "const char*" is necessary in your programming language.
Note that this is a C++ forum. It is language of everyone here. And it does not allows char* pointers to string literals. C does allows it and it was a C design error because for language to allow modification of the read only memory is type safety violation.
And most importantly: On desktops segmented model is dead. Dos is dead. Pre-standard C++ is dead. Stop living in previous century.
the language is called "turbo c++ 1.01". there is also a 3.0 version. probably was a 2.0 also. because the language is old does not mean it does not exist.
the type safe violation is in the newer language(s), not this older dos one.
in turbo c++ 1.01 I can do the char array listed in 1st message here and works with for, while, and do while loops. the bgidemo.c that came with the language also has this format and does work.
here is an example from the demo of this most likely abandonware programming language: