Is it possible to write a C program without using header files? If it is, how?
Of course:
int main() {
return 0;
}
Or even:
int printf(const char *format, ... ); // could be copied from stdio.h
int main() {
printf("Hello, world!\n");
return 0;
}
The #include directive effectively just includes the header file's content in the source file.
Of course.
A header file is just a file that gets included in some source files, and when you include a file you just copy its content.
You can write any program you want to without any #include, but you'd have to manually put the stuff you need in your source files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With