參數(shù)傳遞問(wèn)題

時(shí)間:2018-12-31 12:00:00 資料大全 我要投稿

參數(shù)傳遞問(wèn)題

ATest.cpp: Defines the entry point for the console application.

//參數(shù)傳遞問(wèn)題

include stdafx.h
include iostream
using namespace std;

void fun(int a,int*b,int c,int* d)

{

 a ;

 (*b) ;

 b = new int(10);

 coutaaaa bendl;//地址

 coutbbbb *bendl;//5

 c ;

 d ;

 d = new int(5);

 coutdddd dendl;//地址

 coutdddd2 *dendl;//5

}

int main(int argc, char* argv[])

{

 int a=2,b=3,c=4,d=5;

 int* p = d;

 fun(a,b,c,p);

 coutaendl;//2 值傳遞

 coutbendl;//4 指針傳遞

 coutcendl;//5 引用傳遞

 coutdendl;//5 引用傳遞 指向指針的引用

 cout*pendl;//10 引用傳遞 int(5)為整型初始化

// printf(Hello World!);

 return 0;

}

 

【參數(shù)傳遞問(wèn)題】相關(guān)文章:

1.傳遞正能量

2.團(tuán)隊(duì)游戲-紙杯傳遞

3.團(tuán)隊(duì)游戲:傳遞數(shù)字

4.傳遞正能量句子

5.傳遞正能量句子

6.傳遞數(shù)字 團(tuán)隊(duì)游戲

7.團(tuán)隊(duì)游戲:數(shù)字傳遞

8.年會(huì)游戲:數(shù)字傳遞