Funcional decomposition

Hello everyone

I`m a begineer in c++, and i would like to improve my program (currenlty it works), i need to split it. I have one entire program called main.c but i have one function inside call menu and i would like to write menu in one new file y called menu.c or .h i don't know and inside main.c call it. how can i do that????

Thanks in advance for anyone which can answer the question!!!!

Or at least send me the link where i can find the answer....
so if you have something like this:
1
2
3
4
5
6
7
8
9
10
11
//main.c
#include <something>
type menu ( arguments )
{
   //body
}

int main()
{
    //...
}
You should split your file like this:
1
2
//menu.h
type menu ( argument_types );
1
2
3
4
5
6
//menu.c
#include "menu.h"
type menu ( arguments )
{
   //body
}

1
2
3
4
5
6
7
//main.c
#include <something>

int main()
{
    //...
}
Last edited on
Topic archived. No new replies allowed.