selection sort

it keeps saying that 'error expected initializer before 'void'

how can i make it work? and how can i let it sort an array of 10 elements type integer?



#include <iostream>
using namespace std;
int main()

void selectionSort(int arr[], int n);
{
int i, j, minIndex, temp;

for (i = 0; i < n-1; j++)
if (arr[j] < arr[minIndex])
minIndex = j;

if (minIndex != i)
{temp = arr [i];
arr[i] = arr[minIndex];
arr[minIndex] = temp;
}
return 0;
}
closed account (SECMoG1T)
You missed {} after main ()

I also hope you aren't attempting to define that
void selectionSort(int arr[], int n);{
in main;
Last edited on
Topic archived. No new replies allowed.