help with "function does not take 1 arguments"

This is a discussion on help with "function does not take 1 arguments" within the C++ Programming forums, part of the General Programming Boards category; I am only getting the 1 error "function does not take 1 arguments mean?" on my bubblesort algorithm. what does ...

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    3

    Question 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.

  2. #2
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    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.
    Consider this post signed

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    3
    oh, so can i change

    Code:
    bubblesort(A);
    to
    Code:
    bubblesort(A,G);
    ?

  4. #4
    Registered User
    Join Date
    Aug 2010
    Posts
    3
    cheers man, sorry for any stupid questions, thanks for not replying and taking the ........ with stupid answers
    Last edited by Salem; 08-29-2010 at 10:39 PM. Reason: Language

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 03-31-2010, 04:28 AM
  2. Conceptual ambiguity "function prototype"
    By password636 in forum C Programming
    Replies: 4
    Last Post: 04-02-2009, 12:48 PM
  3. passing arguments using "Command Line Arguments"
    By Madshan in forum C++ Programming
    Replies: 1
    Last Post: 04-19-2006, 03:46 PM
  4. "Function Keys"
    By Necrofear in forum C++ Programming
    Replies: 10
    Last Post: 12-21-2005, 02:03 PM
  5. System("myprog.here arguments") not working
    By antuan2002 in forum C Programming
    Replies: 1
    Last Post: 10-08-2002, 08:53 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21