This is all some stuff from my camp, again, so it's very easy for some of you, just hoping I can help some beginner, or someone completely new to programming.

These are all different ways of sorting numbers from least to greatest. All allow user input.

Bubble Sort incl. User Input
Code:
#include <stdio.h>
#include <stdlib.h>

void print_array(int array[], int size);
void fill_with_random_numbers(int array [], int size);
void sort(int array [], int size, int position);
void swap(int * a, int * b);
//void is unlike int, a statement that says that the program/function will not return anything (int returns an integer)

int main(int argc, char *argv[]){
	
	int size = atoi (argv[1]);
	int array[size]; //array of size 'size'
	int position;
	int swap;
	int counter;
	
	//scanf("%d", &size);
	counter = size;
	
	fill_with_random_numbers(array, size);
	
	printf("This is an array of size %d\n", size);
	
	print_array(array, size);
	
	printf("\n");
	
	sort(array, size, position); 
	
	print_array(array, size);
	printf("\n");
	
	return 0;
}

void print_array(int array[], int size) {
	int i;
	int position;
	i = 0;
	
	
	while (i < size) {
		printf("%d ", array[i]);
		i = i + 1;
	}
	
	
}

void fill_with_random_numbers(int array[], int size) {	
	int i;
	i = 0;
	srandom(time(NULL));

	while (i < size) {
		array[i] = random() & 0x0000ffff;
		i = i + 1;
	}
}

void sort(int array [], int size, int position){
	int counter; 
	counter = size; 
			  while(counter > 0) 
		  {
		  for (position = 0; position < (size - 1); ++position)
		  {
		  if(array[position] > array[position + 1])
		  {
		  swap(&array[position], &array[position + 1]);	  }
		  }
		  counter = counter - 1;
		  }
}

//int * means "pointer to int"
void swap(int * a, int * b){
	int swap;
		  swap = *a; //the  asterisk in this context means 
					 //"dereference" - get the value that the pointer points to
		  *a = *b;
		  *b = swap;
}
Insertion Sort with User Input
Code:
#include <stdio.h>
#include <stdlib.h>

void print_array(int array[], int size);
void fill_with_random_numbers(int array [], int size);
void sort(int array [], int size, int position);
void swap(int * a, int * b);

int main(int argc, char *argv[])
{
	int size = atoi (argv[1]);
	int array[size]; 
	int position;
	int counter;
	
	counter = size;
	
	fill_with_random_numbers(array, size);
	
	printf("This is an array of %d random numbers sorted into ascending order. \n", size);
	
	print_array(array, size);
	
	printf("\n");
	
	sort(array, size, position);
	
	print_array(array, size);
	printf("\n");
	
	return 0;
}

void print_array(int array[], int size) {
	int i;
	int position;
	int swap;
	i = 0;
	
	
	while (i < size) {
		printf("%d ", array[i]);
		i = i + 1;
	}
	
	
}

void fill_with_random_numbers(int array[], int size) {	
	int i;
	i = 0;
	srandom(time(NULL));
	
	while (i < size) {
		array[i] = random() & 0x0000ffff;
		i = i + 1;
	}
}

void sort(int array [], int size, int position){
	int counter;
	counter = size;
	while(counter >= 0) 
{
	for (position = (size - 1); position >= 0; --position)
	{
		if(array[position] < array[position - 1])
		{
			swap(&array[position], &array[position - 1]);
		}
	}
	counter = counter - 1;
}
}

void swap(int * a, int * b){
	int swap;
	swap = *a; 
	*a = *b;
	*b = swap;
}
Selection Sort (badly coded, sorry)
Code:
#include <stdio.h>
#include <stdlib.h>

void print_array(int array[], int size);
void fill_with_random_numbers(int array [], int size);
void sort(int array[], int size);
void swap(int *a, int *b);

int main (int argc, char *argv[]) {

	int size = atoi (argv[1]);
  int array[size];
  int counter;

  counter = size;

  fill_with_random_numbers(array, size);
  
  print_array(array, size);
  printf("\n");

  while (counter > 0) {
    sort(array, size);
    counter = counter - 1;}
  
  print_array(array, size);
  printf("\n");

  return 0;
}

void print_array(int array[], int size) {
  int i;
  i = 0;
  while (i < size) {
    printf("%d ", array[i]);
    i = i + 1;
  }
}

void fill_with_random_numbers(int array[], int size) {
  int i;
  i = 0;
  srandom(time(NULL));

  while (i < size) {
    array[i] = random() & 0x0000ffff;
    i = i + 1;
  }
}

void sort(int array[], int size){
  
  int spot;
  int hold;
  int up;
  int k;
  int place;
  
  up = 0;
  hold = array[0];
  
  while (up < size){
    spot = up;
    place = up;
    while (spot < (size - 1)) {
      if (array[spot] > array[spot + 1]) {
	hold = array[spot + 1];
	place = spot + 1;}
      spot = spot + 1;
    }
    swap(&array[up], &array[place]);
    up = up + 1;
    hold = array[up];
  }
}

void swap(int *a, int *b){
  int hold;
  
  hold = *a;
  *a = *b;
  *b = hold;
}


Notice if you look at these, they all do the same thing, in different ways.