动态数组问题
#include <iostream>
using namespace std;
void sorted(int * ,int *);
void main()
{
int n;
cout<<" input N :"<<endl;
cin>>n;
int *number = new int[n];
sorted(number , &n);
}
void sorted(int *temp , int *m)
{
int swap;
for(int i=0 ; i <= *m ; i++)
{
if(*temp[i] <= *temp[i+1]);
{
swap = *temp[i+1];
*temp[i+1] = *temp[i];
*temp[i] = swap;
}
}
cout<<"the sorted number :"<<endl;
for(int j=0 ; j < *m ; j++)
{
cout<<*temp[j]<<" ";
}
cout<<endl;
红色的地方一定要用指针的指针麽??? 谢谢!
}