+ 1

how to create multiple files for cpp when not using classes

i m doing functional programming so i m not using classes. How can i have separate source file what to define in the header file and how. Example would be helpful

8th Dec 2017, 1:42 PM
shobhit
shobhit - avatar
2 Answers
+ 3
You can use separate files for function prototypes and definitions. In the header file, you will have the prototype: int timesTwo (int a); And in the .cpp file you will have the definiton: int timesTwo (int a) { return 2 * a; ) Of course then you will have to include the header file in main, as well as include the cpp file in the header file.
8th Dec 2017, 3:13 PM
Zeke Williams
Zeke Williams - avatar