C ++ error: expected primary expression before 'int

I get 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;
}

This is where I call functions basically. If you're interested, 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.

+5
source share
3 answers

You cannot use declaration types when you call functions. Only if you need to declare :

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;
}
+10
source

. , ( ) .

if (choice == 2)
    inssort(a, numLines);
// etc

, a switch .

+1
if(choice==2)
{
 inssort(int *a, int numLines);
}

your code will address this

if(choice==2)
{
 inssort(&a, numLines);
}
0
source

All Articles