| | |
Why To include Header Files in Cpp and Not in C Language
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
>I want to know why is it so that, in the Case of C Language there is no
>need to include stdio.h Header file.
It's a (mis)feature in C89 to provide backward compatibility with K&R C. Don't take advantage of it though, you'll end up causing yourself more problems than you can handle. In C99 prototypes are required.
>Why is this?
In K&R C and C89, if a prototype is not supplied, a default function prototype is assumed so that the code will compile. Smart linkers will probably find the right object code and as long as the call is legal, everything may work. Note the terms 'probably' and 'may'. That means that you're doing something incredibly stupid and it's not guaranteed to work.
>need to include stdio.h Header file.
It's a (mis)feature in C89 to provide backward compatibility with K&R C. Don't take advantage of it though, you'll end up causing yourself more problems than you can handle. In C99 prototypes are required.
>Why is this?
In K&R C and C89, if a prototype is not supplied, a default function prototype is assumed so that the code will compile. Smart linkers will probably find the right object code and as long as the call is legal, everything may work. Note the terms 'probably' and 'may'. That means that you're doing something incredibly stupid and it's not guaranteed to work.
I'm here to prove you wrong.
![]() |
Similar Threads
- Working with header files ??? (C)
- Including stdafx.h in other .cpp files (C++)
- #include custom files (C++)
- c vs h header files... (C)
Other Threads in the C++ Forum
- Previous Thread: C++ to .BIN Compiler help
- Next Thread: Binary Code
| Thread Tools | Search this Thread |
api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion convert count data database delete desktop developer directshow dll download dynamic email encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number output parameter pointer problem program programming project proxy python read recursion recursive return string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






