Originally posted by rotis23
ok, its not overloading.
i was just making the point that you can define funtions in c that are defined elsewhere in included libraries using the same name.
You can have more than one function with the same name in a program. They just can't be allowed to see eachother. Otherwise you'll get a compiler error. Example:
File1
Code:
#include <stdio.h>
static void myfun( void )
{
printf("File1:myfun( ) is called.\n");
}
void callfun1( void )
{
myfun( );
}
File2
Code:
#include <stdio.h>
static void myfun( void )
{
printf("File2:myfun( ) is called.\n");
}
void callfun2( void )
{
myfun( );
}
File3
Code:
#include "myheader1.h"
#include "myheader2.h"
int main( void )
{
callfun1( );
callfun2( );
return 0;
}
Compile each file seperately, in order. This assumes you have a header file for each of the others that basicly just prototypes the call function. Link and run.
You can have different files in different modules with the same name. You just have to hide them from eachother so you don't have a problem.
Originally posted by rotis23
please bear in mind that i have been in the middle of a polystyrene fight throughout this dialog.
Did you win?
Quzah.