I am getting this error for every int in this section of code;
if(choice==2) {
inssort(int *a, int numLines);
}
if(choice==3) {
bubblesort(int *a, int numLines);
}
if(choice==4) {
mergesort(int *a, int numLines);
}
if(choice==5) {
radixsort(int *a, int numLines);
}
if(choice==6) {
return 0;
}
Thats where I call the functions in main. If you are wondering I am writing a small program that gives the user a choice when sorting a list between 4 different types of sorting algorithms.
Any help would be appreciated.
You can't use the declaration types when you're calling the functions. Only when you declare them are they needed:
if(choice==2)
{
inssort(a, numLines);
}
if(choice==3)
{
bubblesort(a, numLines);
}
if(choice==4)
{
mergesort(a, numLines);
}
if(choice==5)
{
radixsort(a, numLines);
}
if(choice==6)
{
return 0;
}
You're using function declaration syntax to make function calls. That's not necessary, and (as you have discovered) doesn't even work. You can just write
if (choice == 2)
inssort(a, numLines);
// etc
By the way, a switch
would be more idiomatic here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With