New to C, need help understanding errors
I am new to C and I have to create a program that will take an array, input by the keyboard, and sort it in ascending order. I know there are easier ways but the way I have chosen will get me extra credit in the class which I need. I feel like I am getting close but I keep getting these two errors and I do not understand how to fix them.
If anyone has any suggestions or help it would be much appreciated.
Here are the two errors I am getting
Error 1 error C2447: '{' : missing function header (old-style formal list?) c:\documents and settings\me\my documents\visual studio 2005\projects\array\array\array.cpp 13
and
Error 2 fatal error C1004: unexpected end-of-file found c:\documents and settings\me\my documents\visual studio 2005\projects\array\array\array.cpp 63
and here is my source code:
Code:
// Array.cpp : Defines the entry point for the console application.
//
#include<stdio.h>
#include<stdafx.h>
#include"conio.h"
#include<math.h>
#define x 10
int get_min_range(int list[], int first, int last);
{
first=0;
for(last=1; last<x; ++last){
if (arr[last,arr[first]){
first=last;
return(first)
}
void sort_arr(int arr[], int n)
{
int f,
temp,
index_of_min;
for (f = 0; f < x-1; ++f) {
index_of_min = get_min_range(arr, f, x-1);
if (f != index_of_min) {
temp = arr[index_of_min];
arr[index_of_min] = arr[f];
arr[f] = temp;
}
int main()
{
int arr[x], b=0;
for(int n=0; n<x; n++)
{
printf("Enter a number in the array:");
scanf_s("%d", &arr[n]);
}
sort_arr(arr);
for(b=0; b<x; b++)
printf("%d", arr[b]);
getch();
return (0);
}