这是我在学习期间发现的:
#include<iostream>
using namespace std;
int dis(char a[1])
{
int length = strlen(a);
char c = a[2];
return length;
}
int main()
{
char b[4] = "abc";
int c = dis(b);
cout << c;
return 0;
}
所以在变量int dis(char a[1])
中,[1]
似乎什么都不做,在
我想知道的是为什么编译器允许这种行为(int a[1]
).或者它还有其他我不知道的意思?