Header files Vs. Standard libraries

June 26, 2007 7:30am CST
Hi.Can anyone say me the difference between Standard libraries and header files used in C language?
2 responses
@stribijev (229)
• Poland
26 Jun 07
It looks as if you were asking about the difference between *.lib and *h files, right? Then it is quite obvious: we have function and structure declarations in *.h files, while in *.lib files we have the implementation code of the functions, it is there that the compiler searches for the code to insert into your application. No application will compile if you don't have the necessary library file for a header file. Is that clear? Or, maybe you asked about something different? If you are confused by the word "standard" - I want to say that all those libraries are "standard", as they should be written according to some standards of the language, shouldn't they? and we have a lot of them shipped with our favourite compilers. which one do you use?
• India
26 Jun 07
Turbo C.so library files are included in header files,right?
• India
4 Jan 08
No,it is not like that. Library Files are are different than header files. Look, when you buy any compiler package like TC etc., it ships with some pre-made library functions(like printf, scanf etc) the prototypes of which are declared in the header files(like stdio.h etc). Now just think what will happen if you have very large code that uses a lot of standard library functions. The code will take ages to compile. So, for the convenience and time-saving of programmers, the header files are pre-compiled i.e, only the prototype declaration remains inside the .h file and the compiled object code of the function is stored in a .lib file. Hence when you compile a program, then, in case of the printf functon, the compiler will first look for its declaration in stdio.h and then replaces the code from the corresponding .lib file. With a little effort, you couldalso know which library file is that.
@mnsrwt123 (2058)
• India
1 Apr 08
well there you right track and i can only say that if you know about declaration and defination in C coding , then you find that the header files only include the declaration of the function and the actual defination is present in Library file...