LIBRARY FUNCTIONS IN C CONTENTS q q What

LIBRARY FUNCTIONS IN ‘C’

CONTENTS q q What is a function in ‘c’ programming ? What is a C library? Library functions. The Standard Library Functions.

What is a function in ‘c’ programming? q A function is a group of statements that together perform a task. Every C program has at least one function, which is main(). q Every programmer can design a function according to hisher need.

What is a C library? q q A ‘C’ library is a set of named functions. Definitions of all library functions is already defined in c library. Ex: - printf(); : function is used for output. And definition of this function is alreadydefined in library. Ø

The Standard Library Functions �Some important library functions are given below with header filesv < stdio. h> : I/O functions: ü printf() ü scanf() ü getchar() : returns the next character typed on the keyboard. ü putchar() : outputs a single character to the screen.

v <ctype. h> : data type functions 1. int tolower(int c); : This function converts uppercase letters to lowercase. 2. int toupper(int c); This function converts lowercase letters to uppercase. 3. Digits(); This is a set of whole numbers { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }. 4. Hexadecimal digits(); This is the set of { 0 1 2 3 4 5 6 7 8 9 A B C D E F }.

§ conio. h: console i/o functions 1. getch(); to hold output(console) screen. 2. clrscr(); to clear the output(console) screen. § math. h: mathematical functions 1. pow(); this function is used to find the power of a number. And we have to pass two arguments first is the mumber and second is its power. 2. sqrt(); this function returns squar root of a number. 3. cos(); returns cosine of arg. § graphics. h: graphics functions 1. line(); This function is used to draw a line in c graphics. And we have to pass four arguments x 1, y 1, x 2, y 2.

Thank you…
- Slides: 8