是否有可能在初始化之前获得 strs[i] 的确切地址值,而不是“< Address 0x4 out of bounds >”??如果可能的话,那怎么办?
(gdb) list
15 int main()
16 {
17 int j, i;
18 char *strs[4];
19
20 for (i = 0; i <= 3; i++)
21 {
22 strs[i] = new char [11];
23 }
24
25 for (i = 0; i <= 3; i++)
26 {
27 init(strs[i]);
28 }
29
30 for (j = 0; j <= 3; j++)
31 {
32 cout << strs[j] << endl;
33 }
34
35 return(0);
36
37 }
下面是 strs[i] 的值:
(gdb) p strs[i]
$4 = 0x4 < Address 0x4 out of bounds >