Why does the program run in c without header file.Don't need header file? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does the program run in c without header file.Don't need header file?

Full details

7th Oct 2019, 4:51 PM
Saurabh
Saurabh - avatar
2 Answers
+ 2
Actually, this happens only because of the compiler that you are using. The compiler that is used for compiling C program can only compile programs that are written in C, and any other would be detected as an error by the compiler. The C compiler knows that it is compiling a C program, hence even if donot include the basic header file i.e, stdio.h the compiler will automatically links the file or it knows some of the basic inbuilt functions like scanf(), printf(), etc, so it will not show any error and compiles the program successfully. But, you need to include other header files to use other functions. Sometimes excluding the stdio.h file, some comoilers will show error, as I said it's totally based on the type of compilers.
8th Oct 2019, 6:00 AM
Amal P Franglin
Amal P Franglin - avatar
0
Amal P Franglin , Saurabh Today's was my interview and asked same question
26th Jul 2022, 10:34 AM
Shashi Nirala
Shashi Nirala - avatar