資源簡介
C++實戰源碼-指針作為函數的返回值(入門級實例098).zip
代碼片段和文件信息
//?PointRet.cpp?:?Defines?the?entry?point?for?the?console?application.
//
#include?“stdafx.h“
#include?“iostream.h“
int?*GetDataFromIndex(int?index);//函數原型
int?main(int?argc?char*?argv[])
{
for?(int?i?=?0;i<7;i++)
{
cout?<*GetDataFromIndex(i)?<‘\n‘;//輸出指定索引下的值
}
return?0;
}
int?*GetDataFromIndex(int?index)
{
static?int?Data[]?=?{98563426887549};//定義數組
return?&Data[index];//返回元素的地址
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????453??2010-07-19?13:38??PointRet\PointRet.cpp
?????文件????????4560??2010-07-19?13:32??PointRet\PointRet.dsp
?????文件?????????541??2010-07-19?13:32??PointRet\PointRet.dsw
?????文件?????????295??2010-07-19?13:32??PointRet\StdAfx.cpp
?????文件?????????769??2010-07-19?13:32??PointRet\StdAfx.h
- 上一篇:C++實戰源碼-猴子吃桃
- 下一篇:C++實戰源碼-分解字符串中的單詞
評論
共有 條評論