现在学习C++,书中看到了以下例程:#pragma hdrstop#include <iostream>#include <cstring>using namespace std;char *getname(void);//---------------------------------------------------------------------------#pragma argsusedint main(int argc, char* argv[]){char *name;name = getname();cout << name << " at " << (int *)name << endl;delete [] name;name = getname();cout << name << " at " << (int *)name << endl;delete [] name;return 0;}//----------------------------------------------------------------------------char *getname(){char temp[80];cout << "Enter last name: ";cin >> temp;char *pn = new char (strlen(temp) + 1);strcpy(pn,temp);return pn;}程序的大致意思知道了,但是不明白里面的(int *)name是什么意思?应该是代表输出name的地址吧?
- 2 回答
- 0 关注
- 4180 浏览
添加回答
举报
0/150
提交
取消