471,045 Members | 1,000 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,045 software developers and data experts.

Too many arguments to function

2
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 71095
Banfa
9,065 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");
  3.  
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);

or

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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.