作为参数的数组实际上是指针
2014-03-14 23:41
281 查看
#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; }
相关文章推荐
- 原来数组作为参数时候是可以退化成为指针的,我OUT了
- 指针数组,数组指针,函数指针,main函数实质,二重指针,函数指针作为参数,泛型函数
- 数组名作为函数参数时,退化为指针
- 结构体变量、结构指针变量、结构数组作为函数的参数应用实例分析
- 原来数组作为参数时候是可以退化成为指针的【转载】
- 指针【3-1-24】数组作为函数参数
- 结构体变量、结构指针变量、结构数组作为函数的参数应用实例分析
- 如何理解数组作为函数参数时,数组名就是指针?
- 巩固:数组作为函数参数& 指针作为函数参数的用法
- 原来数组作为参数时候是可以退化成为指针的,我OUT了
- C++中将数组的指针作为函数参数
- C语言 数组名作为参数传递 数组名发生退化成指针
- 结构体变量、结构指针变量、结构数组作为函数的参数应用实例分析 .
- C++中的指针、数组作为参数
- C语言提高-第24/25讲: 数组名【指针】作为函数参数(成绩处理函数版)
- 结构体变量、结构指针变量、结构数组作为函数的参数应用实例分析
- c_指针_一维数组名作为函数参数
- 查找标记(指针和数组名作为参数的区别)
- 数组名作为函数参数时会退化为指针
- C语言中,数组名作为参数传递给函数时,退化为指针