The blog provides study material for Computer Science(CS) aspirants. Mostly says "material nahi milta, padhun kahan se.", I think If you can not find content on the Internet, then you are not a CS student. Dedicated to (Prof. Rakesh Kumar, DCSA, K.U.Kurukshetra, HARYANA, INDIA)- "Ek teacher ka bahut jyada padhna, bahut jyada jaroori hota hai."
Links
▼
Tuesday, 1 October 2013
Libraries in C Language
Overview
There are many libraries full of functions available in C, either
standard libraries that come with most systems or special libraries that
can either be purchased or obtained for free from third parties. ( You
can even create your own libraries. )
This page lists some of the most commonly used libraries and some of the most commonly used functions in each one.
This is not intended to be a complete listing.
See Appendix D of "C Programming, A Modern Approach", Second
Edition, by K.N. King, or most any other good C book for more details.
#include
In order to use library functions, you must #include a header file
that contains definitions for the functions ( and sometimes important
constants ) in the library.
The subtopics listed below correspond to the #include required to
use the libarary in a C program. So to use the math library, you would
need to include a line that said "#include <math.h>" at the
beginning of the program.
<stdlib.h>
The standard C library. Often automatially included when including other headers, but that may be implementation dependent.
RAND_MAX - The maximum value produced by the rand( ) function.
int rand( void ); - Returns a ( pseudo ) random integer from 0 to RAND_MAX
Requires the use of srand ( see below )
( double ) rand( ) / RAND_MAX will yield a random double precison number from 0.0 to 1.0 inclusive.
void srand( unsigned int );
Initializes the random number generator.
Should be called exactly once in a program, usually in main, and before any calls to rand( );
Ex: srand( time( NULL )); - Initializes the random number generator using the time as a seed.
void exit( int ); - Immediate normal program termination.
void abort( void ); - Immediate abnormal program termination.
int abs( int ); - Absolute value
long labs( long ); - Absolute value
See also fabs under <cmath> below.
double atof( const char[ ] ); - Converts a string of numeric characters ( e.g."3.14159E17" ) into a double precision number
atoi and atol convert strings to ints and longs respectively.
NULL - Zero, formatted properly for use as a pointer.
<stdio.h>
The standard C input/output library. Almost every C program ever written needs this header file
printf( ) and scanf( ) - See Formatted I/O
fprintf( ) and fscanf( ) - File versions of printf( ) and scanf( )
sscanf( ) and sprintf( ) - Buffer ( array ) versions of printf( ) and scanf( )
gets( ) and fgets( ) - Reads an entire line of text, including spaces.
( printf( "%s", ... ) stops scanning when it encounters a space. )
fopen( ) and fclose( ) - Used to open and close files
No comments:
Post a Comment