2,586
社区成员
发帖
与我相关
我的任务
分享
char *returnStr()
{
char p[]="hello world!";
return p;
}
int _tmain()
{
char *str;
str=returnStr();
printf("%s\n", str);
return 0;
}
#include <iostream>
using namespace std;
char *returnStr()
{
char p[]="aaa";
return p;
}
int main()
{
char *str;
str=returnStr();
//输出1
cout<<*(str)<<*(str+1)<<*(str+2)<<endl;
//输出2
for(int n=0; n<3; n++)
{
cout<<*(str+n);
}
cout<<endl;
return 0;
}