问一个数组的问题
kofwr 2006-12-25 01:34:11 #include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>
#include <time.h>
int main()
{
const int arraySize = 5;
int face, frequency[ arraySize ] = { 0,1,2,3,4 };
//srand( time( 0 ) );
for ( int roll = 0; roll <= arraySize; roll++ ) {
cout << "index is " << roll ;
cout << " value is " << frequency[ roll ] << endl;
}
cout << frequency[ 10 ] << endl;
}
//突然发现声明数组的时候数组长度是5,但实际请求数组的的n个大于范围的值,也是有默认值输出的,为啥c++是这样子的