![]() |
#2
buffer2011-05-14 20:06
|

#include<iostream>
using namespace std;
const char outstr[11][2]={"┌","┬","┐","├","┼","┤","└","┴","┘","○","●"};//十一个2字节的字符
int main()
{
cout<<strlen("┌")<<endl;;
cout<<outstr[0][0]<<endl;
return 0;
}
程序为什么会出现 数组溢出的问题,把 outstr[11][2]改成 outstr[11][3]或 outstr[11][4]则不报错 十一个2字节的字符数组存在 outstr[11][2]为什么会溢出呢?
using namespace std;
const char outstr[11][2]={"┌","┬","┐","├","┼","┤","└","┴","┘","○","●"};//十一个2字节的字符
int main()
{
cout<<strlen("┌")<<endl;;
cout<<outstr[0][0]<<endl;
return 0;
}
程序为什么会出现 数组溢出的问题,把 outstr[11][2]改成 outstr[11][3]或 outstr[11][4]则不报错 十一个2字节的字符数组存在 outstr[11][2]为什么会溢出呢?
[ 本帖最后由 niu91 于 2011-5-14 18:50 编辑 ]