Include a .c file within a main project.c

4

I am developing a simple program to deliver at the end of the first semester and would like to know if it is possible to create a main project and make the menu in a separate menu.c . Then include the menu.c file inside the main project?

Example:

#include <stdio.h>

int main () {

  /* Esse é o projeto principal que esta salvo como projeto.c
     e queria incluir aqui o menu.c */


   return(0);
}

Then I want to save menu.c and include it within projeto.c above.

    
asked by anonymous 25.10.2015 / 22:15

1 answer

5

To do what you want, just put a #include "menu.c" where you want to include it. But I doubt this is what you really need.

The correct solution is to compile the two files, one called the other's functions. This can be done at the command line or by adding all the files in the project managed by the IDE.

    
25.10.2015 / 22:24