1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <iostream> #include <cstring> using namespace std; #define MAX_LEN 8 #define CNT 3 #define TEXT1 ("dog") #define TEXT2 ("cat") #define TEXT3 ("rabbit") typedef char MyStringType[MAX_LEN]; int main() { MyStringType* Str; Str = new MyStringType[CNT]; strcpy(Str[0], TEXT1); strcpy(Str[1], TEXT2); strcpy(Str[2], TEXT3); for(size_t ix=0; ix!=CNT; ++ix) cout << Str[ix] << endl; return 0; } |
Direct link: https://paste.plurk.com/show/351617