# help with "function does not take 1 arguments"

• 08-29-2010
sthomas1989
help with "function does not take 1 arguments"
I am only getting the 1 error "function does not take 1 arguments mean?" on my bubblesort algorithm.
what does this mean?!
i believe the bit its having trouble with is line
Code:

`bubblesort(A);`
where i call my function bubblesort to work on array A[]
but just incase, here is my top part
Code:

```#include <iostream> using namespace std; const int numberofintegers=1000; int G=0; void bubblesort(int A[], int G); int A[numberofintegers];```
and my function at the bottom
Code:

```void bubblesort(int A[], int G){         int Q, W, E;         for (int Q=0; Q<G; Q++){                 for (int W=0; W<G-1; W++){                         if (A[W+1]<A[W]){                                 E = A[W+1];                                 A[W+1]=A[W];                                 A[W]=E;                         }                 }         } }```
im sorry if this isnt a correct way to post, im new, but any help you could give me would be greatly appreciated. thanks.
• 08-29-2010
bernt
Quote:

function does not take 1 arguments mean
It means the function takes a number of arguments not equal to 1. It's actually a pretty self-explanatory message. Much better than a segmentation violation, by any measure.

Code:

```void bubblesort(int A[], int G); ... bubblesort(A);```
Notice how bubblesort is defined with two arguments, yet you call it with one? That's the problem.
• 08-29-2010
sthomas1989
oh, so can i change

Code:

`bubblesort(A);`
to
Code:

`bubblesort(A,G);`
?
• 08-29-2010
sthomas1989
cheers man, sorry for any stupid questions, thanks for not replying and taking the ........ with stupid answers :)