What is Standard Library and How this Empowers a C Programmer

«
»
Question: What is Standard Library and How this Empowers a C Programmer

Answer: Programming in C requires any C program to use various different functions for different requirements to be best taken care of. For ex. to copy a string ‘strcpy()’ library function, for printing formatted data to stdout, ‘printf()’ is used. There are several dozens of functions which facilitate every C programmer in writing programs for different requirements. All these functions are put together in the standard library. Though, functions performing somewhat similar tasks are put together in same header file. For ex. functions performing input and output are put together in ‘stdio.h’ header, those performing string manipulations are defined in ‘string.h’ header.

You can view header files for Standard Library on your machine (Linux) by executing following command

advertisement
    cd /usr/include; vi stdio.h; /* There are many header files in this directory */
    ls -l /lib/libc* / * this will show libc the shared library */

ANSI C standard defines library of functions included in specification. Each ANSI implementation will have mandated set of functions, and they will have the required interface and that they work in prescribed manner. This makes writing portable programs with ease. Since library defines functions for almost every requirement, this empowers a C programmer in writing efficient and portable programs.

Sanfoundry Global Education & Learning Series – 1000 C Tutorials.

If you wish to look at all C Tutorials, go to C Tutorials.

advertisement
advertisement
advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn