468,463 Members | 2,036 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,463 developers. It's quick & easy.

Too many arguments to function

I am trying to compile a program for school and i get a error message back. "In function ... too many arguments to function. What does this mean?
Oct 10 '06 #1
2 66791
9,051 Expert Mod 8TB
It means you are making a function call and have supplied too many arguments in the place that you call the function. i.e. you have more parameters where you call the function than where it is defined.

For instance this code would generate this error, noting strcpy is defined as

char * strcpy ( char * dest, const char * src );

Expand|Select|Wrap|Line Numbers
  1. char string[100];
  2. strcpy(string, "Hello", "World");
Because strcpy take 2 arguments or parameters but I have supplied 3.
Oct 11 '06 #2
You defined a function with two parameters as following:
int sum (int, int);

but you call this function with three or more arguments as following:

s = sum(100, 200, 300);


s = sum(10, 20, .....);

in this case too many arguments to function error will occure.
Oct 11 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by A. Saksena | last post: by
3 posts views Thread by celalo | last post: by
2 posts views Thread by jhullu | last post: by
7 posts views Thread by sfeher | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.