+ 1

Is it possible to create the c and c++ program without any header files

8th Jun 2019, 4:59 AM
Deepak Kumar.G
6 Answers
8th Jun 2019, 5:21 AM
Vlad Serbu
Vlad Serbu - avatar
+ 5
Vlad Serbu although you didn't explicitly included stdio.h the C compiler added it for you, usually c compilers are able to resolve your call to stdio printf by adding the header and leaving a warning. Anyway the answer is right, Yes.
8th Jun 2019, 7:52 AM
AZTECCO
AZTECCO - avatar
+ 5
Good one Vlad Serbu ! I assumed it and I was wrong! Great lesson. What I've found is that c is able to implicitly declare a function , then the compiler finds a match in the std and links it, but... is undefined behaviour since printf takes variable number of arguments. That's why it gives warning to define printf or include stdio.h
8th Jun 2019, 8:58 AM
AZTECCO
AZTECCO - avatar
+ 1
AZTECCO it's not that it adds the header for you, it's that it links against the standard library.
8th Jun 2019, 7:56 AM
Vlad Serbu
Vlad Serbu - avatar
+ 1
AZTECCO Another clue is that macros (such as NULL) don't work.
8th Jun 2019, 9:27 AM
Vlad Serbu
Vlad Serbu - avatar
0
short answer, Yes!
29th Aug 2020, 3:06 PM
Azat
Azat - avatar