c++中传递数组给函数时,为什么不能在子函数中求数组长度
记录一个常识性错误
在写一个程序时发现一个错误,经过反复调试发现:在主函数中求长度和在子函数中求长度的结果不一样。例如:
#include <iostream>
using namespace std;
int getwater(int*);
int main()
{
int arr[] = { 3, 1, 2, 4 };
int result = getwater...
原创
2018-03-30 11:56:56 ·
1687 阅读 ·
0 评论