Answer to Question #1090 in C# for Eric

Question #1090
List the benefits of using libraries in C programming.

What is contained in the stdio library? What are the benefits of using this library?
Expert's answer
1. Benefits of using libraries in C programming.

& * The code in the main program is much shorter using libraries
& * Reusing code: the user has not to write by hands the functions which are currently, present in the library.
For instance in "pure" C there are no
& & - mathematical functions like& cos, sin, abs ...
- functions for converting numbers to string and vise versa
- functions for input-output operations with files and in particular with standard output
- functions for allocating and freeing memory
- functions for checking time and date
- functions for working with strings but they are presented in libraries
math, sdtlib, stdio, time, string.

& * The functions in libraries are optimized, e.g. some of their parts are written in assembler and many people worked on them.
Therefore, the function written by the user by hands in most cases will be slower than the analogous function from the library.
& * Usually the functions in library are guaranteed to work on any platform that supports C, though this is not true for all libraries.
& * Using of library is very simple: programmers just have to include the header-file of the library in his source code, e.g.
& #include<stdio.h>

2. stdio library contains the following functions
- functions for reading-writting files, fopen, fsetpos, fread, fwrite, fclose, feof
- functions for formatter input output,& printf, scanf - to stdout/ from stdin
fprintf, fscanf - to/from file
sprintf, sscanf - to/from string
- functions for character input-output,
putc - write one character to stdout
getc - read one character from stdin
fputc, fgetc - read/write one character to/from file
3. Benefits of using stdio:
All benefits from 1 hold for library stdio.
The most benefit is that input-output operation can be used at once after including the library into source code.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be the first!

Leave a comment

Ask Your question

New on Blog