The C Programming Language calls stdio.h
a library. However, I am being told that it's a header file only meant for the compiler, which is true, and therefore it's not a library.
Other programming sites on the Internet call it a library. Is the definition of library different now?
Some C programs start with #include <stdio.h>
because the C language does not include file manipulation functions.
Update with quote from The C Programming Language by Brian Kernighan and Dennis Ritchie, Second Edition, page 3 (Introduction):
A second significant contribution of the standard [ refers to "the ANSI standard, or "ANSI C", completed in 1988] is the definition of a library of accompany C. It specifies functions for accessing the operating system (for instance to read and write files), formatted input and output, memory allocation, string manipulation, and the like. ... Programs that use this library to interact with a host system are assured of compatible behavior. Most of the library is clostly modeled on the "standard I/O library" of the UNIX system. This library was described in the first edition ...
It would seem a logical conclusion that the definition of library has evolved/changed/updated...
No, stdio.h
is not a library, it's a header file. A common mistake when approaching C is to call every header file a library, that's just wrong.
The C standard library is a collection of functions, which are declared in header files, and stdio.h
is one of them. The name stands for "Standard Input Output", so in that file you can find all the declarations of functions that deal with input, output and files. You can find a list of the header files included in the C standard library here.
A library is a compiled binary file (or in general, a collection of binary files), which can be linked when compiling a program to take advantage of the functions made available by the library (i.e. exported). Header files are then used to identify the names and the signatures of those functions, so that the compiler knows how to call them.
Commonly, for small libraries, a single header file is enough, so that's easy for beginners to confuse an header file with the library itself. The C standard library however is very complex and has a lot of functions, so they are declared in different header files.
C programs start with
#include <stdio.h>
because the C language does not include file manipulation functions.
Yes, that's right. The C specification only concerns the language itself (syntax, types, etc), and does not define any "standard" function.