对于这个任务,我有在升序排序列在我的司机使用另一个文件中写入选择排序功能的结束。我已经为这个错误搜索了这个问题,而且我还没有发现任何我见过的可以帮助我。有人可以帮我吗?错误:控制达到C非void函数++的选择排序功能
这是我到目前为止。
#include <iostream>
using namespace std;
void *selectionsort(int values[], int size){
for(int i=0; i<size-1; i++){
for(int j=0; j<size; j++){
if(values[i] < values[j]){
int temp = values[i];
values[i] = values[j];
values[j] = temp;
}
}
}
}
这里是我的驱动程序,如果需要的话。
#include <stdlib.h>
#include <iostream>
#include "selection.cpp"
using namespace std;
#define ArraySize 10 //size of the array
#define Seed 1 //seed used to generate random number
int values[ArraySize];
int main(){
int i;
//seed random number generator
srand(Seed);
//Fill array with random intergers
for(i=0;i<ArraySize;i++)
values[i] = rand();
cout << "\n Array before sort" << endl;
for(i=0;i<ArraySize; i++)
cout << &values[]<< "\n";
//int* array_p = values;
cout << "\n Array after selection sort." << endl;
//Function call for selection sort in ascending order.
void *selectionsort(int values[], int size);
for (i=0;i<ArraySize; i++)
cout << &values[] << "\n";
//system("pause");
}
这是不是你调用一个函数...摔落'无效*'。另外为什么是void函数的指针? – smac89