This is what your file looks like before
Code:
// prog.c
#include <stdio.h>
int foo ( );
int bar ( char *msg );
int main ( ) {
int a = foo();
int b = bar( "hello " );
printf( "%d %d\n", a, b );
return 0;
}
int foo ( ) {
return 0;
}
int bar ( char *msg ) {
printf( "%s", msg );
return 0;
}
And this is what it looks like when you've created funcs.c and funcs.h
Code:
// funcs.h
int foo ( );
int bar ( char *msg );
// prog.c
#include <stdio.h>
#include "funcs.h"
int main ( ) {
int a = foo();
int b = bar( "hello " );
printf( "%d %d\n", a, b );
return 0;
}
// funcs.c
#include <stdio.h>
#include "funcs.h"
int foo ( ) {
return 0;
}
int bar ( char *msg ) {
printf( "%s", msg );
return 0;
}
You would compile this using say
bcc proc.c funcs.c