+ 5
Can i run a C or C++ program without using any header files ??
If yes then How ??? . . and if No then why ???
3 Answers
+ 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
+ 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.
+ 3
you can, but you'll need to do a lot of dirty work with assembly to print and to get input.