#include
using namespace std;
int* order (int* const list,int size);
int main()
{ int size;
cout<<"数组的大小为:"<
cin>>size;
int* list =new int [size];
cout<<"请输入数组元素:"<<endl;
for (int i=0;i<size;i++)
{cin>>list[i];}
for(int j=0;j<size;j++)
{cout<<&list[j]<<"为"<<list[j]<<"所对应的指针指向的地址."<<endl;}
order(list,size);
cout<<"按升序输出数组元素为:"<<endl;
for (int k=0;k<size;k++)
{cout<<*(list+k)<<" ";
delete []list;
return 0;
}
int* order (int* const list,int size)
{
for(int l=0;l
{ for (int j=l+1;j
{ if(list1[l]>list1[j])
{
int tem;
tem=list1[l];
list1[l]=list1[j];
list1[j]=tem;
}
}
}
return list;
}
编译时老是显示:
[Error] a function-definition is not allowed here before '{' token
[Error] expected '}' at end of input