1#include <iostream>
2
3using namespace std;
4
5int main(int argc, char *argv[])
6{
7 char *str1 = new char[10];
8 char *str2 = new char[5];
9 char *str3 = new char[10];
10
11 for (int i=0; i<9; i++)
12 {
13 str1[i] = 'a';
14 str3[i] = 'c';
15 }
16 str1[9] = 0;
17 str3[9] = 0;
18 for (int i=0; i<4; i++)
19 {
20 str2[i] = 'b';
21 }
22 str2[4] = 0;
23
24 char **strArray = new char*[3];
25 strArray[0] = str1;
26 strArray[1] = str2;
27 strArray[2] = str3;
28
29 cout << strArray[0] << endl;
30 cout << strArray[1] << endl;
31 cout << strArray[2] << endl;
32
33 /*******************************************/
34 char **strArray2 = new char*[3];
35 strArray2[0] = new char[10];
36 strArray2[1] = new char[5];
37 strArray2[2] = new char[10];
38
39 for (int i=0; i<9; i++)
40 {
41 (strArray2[0])[i] = 'a';
42 (strArray2[2])[i] = 'c';
43 }
44 (strArray2[0])[9] = 0;
45 (strArray2[2])[9] = 0;
46 for (int i=0; i<4; i++)
47 {
48 (strArray2[1])[i] = 'b';
49 }
50 (strArray2[1])[4] = 0;
51
52 cout << strArray2[0] << endl;
53 cout << strArray2[1] << endl;
54 cout << strArray2[2] << endl;
55
56 return 1;
57}