003 好怪异的返回值

#include <iostream>
using namespace std;
int & getElement(int * a, int i)
{
	return a[i];
}
int main()
{
	int a[] = {1,2,3};
	getElement(a,1) = 10;
	cout << a[1] ;
	return 0;
}
posted @ 2022-02-19 22:35  icefield817  阅读(65)  评论(0编辑  收藏  举报