ok so im fairly new to C, but im hoping to progress quickly
im trying to do an exercise or rather change it from a tutorial
iv spent some time but can't figure out why this isnt running
it doesnt ask me for input althought it shud do
Code:
#include <stdio.h>
int a[5];
int bubblesort(); /* function prototype for bubble sort */
int takeinput();
int main()
{
int takeinput();
int bubblesort();
}
int takeinput()
{
int input;
int i;
int b;
i = 0;
b = 5;
for (i=0; i < b; i++)
{
scanf("%d",&input);
a[i] = input;;
}
return 0;
}
int bubblesort()
{
/* bubble sort the array */
int x,y,t,i;
int n = 5;
for (x=0; x < n-1; x++)
for (y=0; y < n-x-1; y++)
if (a[y] > a[y+1])
{
t=a[y];
a[y]= a[y+1];
a[y+1]=t;
}
/* print sorted array */
printf("--------------------\n");
for (i=0; i < n; i++)
printf("%d\n",a[i]);
return 0;
}
i will appreciate it if someone can point me in the right direction ..
as to where im going wrong , there are no compile errors ..