basically this is what i mean:
Code:
skalkoto@darkstar:~$ cat code.c
#include <stdio.h>
int main()
{
void func(void);
func(3);
return 0;
}
void func(int a)
{
printf("Nothing\n");
}
skalkoto@darkstar:~$ gcc code.c
code.c: In function `main':
code.c:6: error: too many arguments to function `func'
skalkoto@darkstar:~$ cat code1.c
#include <stdio.h>
int main()
{
void func();
func(3);
return 0;
}
void func(int a)
{
printf("Nothing\n");
}
skalkoto@darkstar:~$ gcc code1.c
skalkoto@darkstar:~$ ./a.out
Nothing
skalkoto@darkstar:~$
when you declare somewhere a function func(), this means you don't say anything about it's aguments.
On the otherhand func(void) means NO ARGUMENTS
P.S. When i started learning c you could not use a function if the body of the function was in the same file but under
the calling point of the function without declaring the function above the calling piont. Nowdays gcc has not those problems.
I miss those old days, everything was so clear.