so my teacher wants the function prototypes and typedefs for my project stored in a separate .c file.
so main.c has the stuff to do, another.c has the protypes and typedefs, and another.h has the declarations.
how can i do this? i am using GNU GCC compiler because it seems like this is a compiler specific issue. i was trying gcc another.c but the compiler doesn't recognize the gcc so i think I'm doing it wrong.
i feel so dense.... i have the entire project working good but everything that's supposed to be in the another.c is in the another.h....
thanks
The main.c will look something like this:
// bring in the prototypes and typedefs defined in 'another'
#include "another.h"
int main(int argc, char *argv[])
{
int some_value = 1;
// call a function that is implemented in 'another'
some_another_function(some_value);
some_another_function1(some_value);
return 1;
}
The another.h should contain the typedefs and function prototypes of the functions found in another.c file:
// add your typdefs here
// all the prototypes of public functions found in another.c file
some_another_function(int some_value);
some_another_function1(int some_value);
The another.c should contain the function implementations of all the function prototypes found in another.h:
// the implementation of the some_another_function
void some_another_function(int some_value)
{
//....
}
// the implementation of the some_another_function1
void some_another_function1(int some_value)
{
//....
}