#include "stdafx.h"
#include <iostream>
using namespace std;
void f(int b[])
{
cout << "======== f ========" << endl;
cout << "b == " << b <<endl;
/*
无法再另一个函数中自动的决定一个数组编译时的大小
*/
cout << "sizeof b == " << sizeof b << endl;
cout << "======== f ========" << endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
int a[] = {1,2,3,4};
f(a);
/*
输出:
======== f ========
b == 0018FF1C
sizeof b == 4
======== f ========
*/
system("pause");
return 0;
}
作为参数的数组实际上是指针
最新推荐文章于 2022-07-20 13:56:50 发布