Steve Graegert wrote:
I have modified the code to clarify my thoughts:
#include <stdio.h>
/* prototype */
void add(); /* call with arbitrary number of arguments */
void add (int a, int b, int c) {
printf ("inside function: add(%d, %d)\n", a, b);
return;
}
int main (void) {
/* call function add with some parameters */
add(5, 1);
getc(stdin);
return (0);
}
Do you see the difference? No warning is issued, because there is
nothing wrong with it (it is not recommended by ANSI C99 but still
valid).
Inside "main", did you mean to write the function call as " add (5,
1, <some number>); ". Cos' when I copy the code, and try to run it, it
throws me this error message during compilation.
- too few arguments to function `add'-
Am I fundamentally going wrong in my understanding of functions?
No you're not. You're just curious :-)
Thanks!
_z33
--
I love TUX; well... that's an understatement :)
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming"
in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html