Header Files:-
Ø In ‘c, a number
of pre-defined functions are available to perform various tasks. To use these functions, we have to include
the corresponding header file in which the function is available.
1.
stdio.h:- (standard input output
library functions).
·
When
any of the functions getchar ( ), qets ( ), putchar ( ), puts ( ), scanf( ),
printf ( ) is used the header file stdio.h has to be included.
2. math.h:- (mathematical functions)
1.
pow ( ):-This function returns xn
value.
Syntax:- pow
(x,n); Eg:- pow (5,3)=53=125.
2. sqrt ( ):-This function
performs square root of the given number.
Syntax:- sqrt (n); Eg:-
sqrt (81)=9.
3. log ( ):-This function
returns natural logarithm of the given number.
Syntax:- log
(n); Eg:- log (8);
4. log10 ( ):-This functions returns logarithm value of the given
number to the base 10.
Syntax:- log10
(n); Eg:- log10(10)=1
5. exp( ):-This function
returns er value.
Syntax:- exp (x);
Eg:- exp(3);
6. ceil ( ):-This function returns the next higher integer value of
the given number.
Syntax:- ceil(n);
Eg:- ceil (17.7)=18 ceil (1b.1)=17.
7. floor( ):-This function returns the
integer value less than or equal to the given number.
Syntax:- floor (n);
Eg:- floor (17.7) = 17 floor(16.1) = 16.
Cos, acos, cosh, sin, asin, sinh, tan, atan, tanh are
also the functions under this header file.
3. Stdlib.h:- (standard Library
functions header file)
(i)
abs( ):-This functions returns the
absolute value of a given, integer.
Syntax:- abs
(integer value); Eg:- abs (-17); =17.
(ii)
fabs( ):-This functions returns
absolute value (modulus) of a given
floating point number.
Syntax:- fabs (float
value); Eg:- fabs (-17.6) = 17.6.
(iii) ato i (
):-This function converts the given string to an integer value.
Syntax:- atoi(string); Eg:-
atoi (“123”) =123.
(iv)
atof ( ):-This function converts the
given string into floating point value.
Syntax:-
atof (string); Eg:- atof
(“ 123.56”) = 123.560000.
4. ctype. h:- (character testing and conversion functions)
(i) isalpha( ):-This function checks
whether the given character is an alphabet (or) not.
If
it is an alphabet, it returns a non-zero value and otherwise a zero value.
Syntax:-
is alpha(‘a’); True
Eg:-
isalpha
(‘a’) True (non-zero)
isalpha(‘2’) Flase (zero)
(ii) isalnum(
):- This function checks whether the given character is an alphabet or a
number. If true it returns a non-zero
value other wise a zero value.
Eg:-
isalnum(‘1’) True (non-zero)
isalnum(‘q’) False (zero)
(iii) isdigit
( ):-This function checks whether the given character is a digit or
not. If true it returns a non-zero value
otherwise a zero value.
Eg:-
isdigit (‘a’) True (non zero)
Isdigit(‘*’) False (zero)
(iv)
islower ( ):-This function checks
whether the given character is a Lower case alphabet or not. If it is a small letter it returns a non-zero value otherwise a zero
value.
Eg:-
islower (‘b’) True (non-zero)
islower (‘A’) False (zero)
(v) isupper
( ):-This function checks whether the given character is a upper case
alphabet or not. If it is a capital
letter is returns a non-zero value otherwise a zero value.
Eg:-
isupper (‘B’) True
(non-zero)
isupper(‘q’) False (zero)
(vi)
toupper ( ):-This function
converts the given small letters to an upper case letter.
Eg:- toupper (‘b’)=B
toupper(‘q’)=Q
(vii) tolower ( ):-
This
function converts the given capital letters to a Lower case letter.
Eg;- tolower (‘B’) =b
tolower (‘Q’)=q
(viii)
toascii( ):-This function returns the
equivalent ASCII value for the given character.
Eg:- toascii (‘a’) = 97
toascii(‘B’) = 66
No comments:
Post a Comment