+ 5

Can i run a C or C++ program without using any header files ??

If yes then How ??? . . and if No then why ???

23rd Jan 2018, 7:26 AM
Abhi kmr
3 odpowiedzi
+ 5
It may be possible to create a program without headers. But the only issue is you will have to redefine the printing functions, the classes, and other daily use functions. For example, consider : int main() { int a = 2, b = 3; return a+b; } Now this code does nothing at all, though it compiles without fail. I also found the following code that compiles perfectly and does not include any headers : https://code.sololearn.com/c30q8XNr6HMI/?ref=app Also, you may visit: https://stackoverflow.com/questions/18223649/c-c-program-without-header-files
23rd Jan 2018, 8:21 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 3
Yes it is possible but it's not recommended because then you have to write the code for the things you should use from headers. For example if you don't use iostream then you have to write extra code for getting input or for printing an output.
23rd Jan 2018, 8:17 AM
bogdan
bogdan - avatar
+ 3
you can, but you'll need to do a lot of dirty work with assembly to print and to get input.
23rd Jan 2018, 8:24 AM
Cain Eviatar
Cain Eviatar - avatar