string test(string str,int x){ string sum; Tool tool; vectorint list{1,2,3,4,5}; //test2(list); int rv 1; for(int i:list){ rvrv*i; } return tool.jlong2str(rv); } void test2(vectorint list){ list.clear(); }现在使用引用string test(string str,int x){ string sum; Tool tool; vectorint list{1,2,3,4,5}; test2(list); int rv 1; for(int i:list){ rvrv*i; } return tool.jlong2str(rv); } void test2(vectorint list){ list.clear(); }可以看到list的数据已经被清除了现在改成不用用数值来试试看string test(string str,int x){ string sum; Tool tool; vectorint list{1,2,3,4,5}; test2(list); int rv 1; for(int i:list){ rvrv*i; } return tool.jlong2str(rv); } void test2(vectorint list){ list.clear(); }可以看到---------没有能够修改以前的数组现在我来把他换成指针string test(string str,int x){ string sum; Tool tool; vectorint list{1,2,3,4,5}; test2(list); int rv 1; for(int i:list){ rvrv*i; } return tool.jlong2str(rv); } void test2(vectorint *list){ list-clear(); }我很聪明的发现用指针也能实现修改原来的数组。