C++数组作为返回值

直接上代码。很容易看的。
int* aa(int a,int b)
{
	int *c=new int[2];
	c[0]=a;
	c[1]=b;
	return c;
} 

int main()
{
	int* d;
	d=aa(1,2);
	cout<<d[1];
}
发布了48 篇原创文章 · 获赞 23 · 访问量 1334

猜你喜欢

转载自blog.csdn.net/qq_37724465/article/details/96457476