Standard c library: http://www.cppreference.com/===================================== ========================================================================================================================================================00 ==================================
Standard CI / Oclearerr () clears errorsfclose () close a filefeof () true if at the end-of-fileferror () checks for a file errorfflush () writes the contents of the output bufferfgetc () get a character from a streamfgetpos () get the file position indicatorfgets () get a string of characters from a streamfopen () open a filefprintf () print formatted output to a filefputc () write a character to a filefputs () write a string to a filefread () read from a filefreopen () open an existing stream with a different namefscanf () read formatted input from a filefseek () move to a specific location in a filefsetpos () move to a specific location in a fileftell () returns the current file position indicatorfwrite () write to a filegetc () read a character from a filegetchar () read a character from STDINgets () read a string from STDINperror () displays a string version of the current error to STDERRprintf () write formatted output to STDOUTputc () write a character to a streamputchar () w rite a character to STDOUTputs () write a string to STDOUTremove () erase a filerename () rename a filerewind () move the file position indicator to the beginning of a filescanf () read formatted input from STDINsetbuf () set the buffer for a specific streamsetvbuf () set the buffer and size for a specific streamsprintf () write formatted output to a buffersscanf () read formatted input from a buffertmpfile () return a pointer to a temporary filetmpnam () return a unique filenameungetc () puts a character back into A streamvprintf, vsprintf, vsprintf write formatted output with variable argument lists ============================
================= Standard c string and character, () Converts a string to a doubleatoi () Converts a string to a longisalnum () TRUE IF alphanumericisalpha () true if alphabeticiscntrl () true if control characterisdigit () true if digitisgraph () true if a graphical characterislower () true if lowercaseisprint () true if a printing characterispunct () true if punctuationisspace () true if spaceisupper () true if uppercase characterisxdigit () true if a hexidecimal charactermemchr () searches an array for the first occurance of a charactermemcmp () compares two buffersmemcpy () copies one buffer to anothermemmove () moves one buffer to anothermemset () fills a buffer with a characterstrcat () concatenates two stringsstrchr () finds the first occurance of a character in a stringstrcmp () compares two stringsstrcoll () compares two strings in accordance to the current localestrcpy () copies one string to anotherstrcspn () searches one string f or any characters in anotherstrerror () returns a text version of a given error codestrlen () returns the length of a given stringstrncat () concatenates a certain amount of characters of two stringsstrncmp () compares a certain amount of characters of two stringsstrncpy () copies A Certain Amount of Characters from One String To Anotherstrpbrk () Finds The First Location of Any Character in One String,
in another stringstrrchr () finds the last occurance of a character in a stringstrspn () returns the length of a substring of characters of a stringstrstr () finds the first occurance of a substring of charactersstrtod () converts a string to a doublestrtok () finds the next token in a stringstrtol () converts a string to a longstrtoul () converts a string to an unsigned longstrxfrm () converts a substring so that it can be used by string comparison functionstolower () converts a character to lowercasetoupper () converts a character TO Uppercase ===================================================== Standard C Mathabs () absolute valueacos () arc cosineasin () arc sineatan () arc tangentatan2 () arc tangent, using signs to determine quadrantsceil () the smallest integer not less than a certain valuecos () cosinecosh () hyperbolic cosinediv () returns the quotient and Remainder of a divisionexp () Returns "e" raised to a given powerfabs () ABSOLUTE VALUE for floating-point number value for floating-point number value () Returns th e largest integer not greater than a given valuefmod () returns the remainder of a divisionfrexp () decomposes a number into scientific notationlabs () absolute value for long integersldexp () computes a number in scientific notationldiv () returns the quotient and remainder of a division , in long interest formlog () Natural Logarithmlog10 () Natural Logarithm,
in base 10modf () decomposes a number into integer and fractional partspow () returns a given number raised to another numbersin () sinesinh () hyperbolic sinesqrt () square roottan () tangenttanh () hyperbolic tangent ========= ===================================================== Standard C Time & Dateasctime () A Textual Version of the TimeClock ) returns the amount of time that the program has been runningctime () returns a specifically formatted version of the timedifftime () the difference between two timesgmtime () returns a pointer to the current Greenwich Mean Timelocaltime () returns a pointer to the current timemktime ( Returns the Calendar Version of a given timeStrftime () Returns Individual Elements of the date and timetime () Returns The current caledar time of the system ===================== ======================== Standard C MemoryCalloc () Allocates A Two-Dimensional Chunk of MemoryFree () Makes Memory Available for Future AllocationMalloc () Allocates MemoryRealloc () Allocates MemoryRealloc Changes the Si Ze of previously allocated memory ============================================= Other Standard C FunctionsAbort () Stops The Program IF AN Expression IsoN't trueXit () sets a
function to be called when the program exitsbsearch () perform a binary searchexit () stop the programgetenv () get enviornment information about a variablelongjmp () start execution at a certain point in the programqsort () perform a quicksortraise () send a signal to the programrand () returns a pseudorandom numbersetjmp () set execution to start at a certain pointsignal () register a function as a signal handlersrand () initialize the random number generatorsystem () perform a system callva_arg () use variable length parameter lists **** *********************************************************** *********************************************** ============ ========================================= STANDARD CI / OCLEARERRSYNTAX:
#include
The clearrr function resets the error flags and eof indicator for the given stream. When an Error Occurs, You Can Use
PERROR () TO Figure Out Which Error Actually Occurred.Reled Topics: Feof (), Ferror (), and perror (). fclosesyntax:
#include
The function fclose () Closes The Given File Stream, Deallocating Any Buffers Associated with That Stream. Fclose () Returns 0
UPON SUCCESS, AND EOF Otherwise.Related Topics: Fopen (), Freopen () () FFLUSH () FeOfsyntax:
#include
THE FUNCTION Feof () Returns A Nonzero Value If The End of The Given File Stream Has Been Reached.Reled Topics: Clearerr (), Ferror (), Perror (), PUTC (), getc () Ferrorsyntax:
#include
The ferror () function looks for errors with stream, returning zero if no errors have occured, and non-zero if there is anerror In case of an error, use perror () to determine which error has occured.Related topics:. Clearerr ( ), feOf (), perror () fflushsyntax:
#include
If the given file stream is an output stream () causes the output buffer to be written to the file. If the given
Stream is of the input type, damlush () causes the input buffer to be cleared. fflush () is useful when debugging, IF a
Program segfaults before it has a chance to write output to the screen. Calling fflush (stdout) Directly after debugging. - DIRECTLY AFTER DEBUGGING
Output Will EnSure That Your Output Is Displayed At The Correct Time.
Printf ("Before first Call / N"); fflush (stdout); shady_function (); Printf ("Before Second Call / N"); FFLUSH (stdout); dangerous_dereference ();
Related Topics: fclose (), Fopen (), FREAD (), FWRITE (), getc (), PUTC () Fgetcsyntax:
#include
THE FGETC () Function Returns The next Character from Stream, or EOF IF IS An Error.Reled Topics: FPUTC (), getc (), PUTC (), Fopen () FGETPOSSYNTAX:
#include
The Fgetpos () Function Stores The File Position Indicator of The Given File Stream in The Given Position Variable. The Given Position Variable..
Position variable is of type fpos_t (which is defined in stdio.h) and is an an Object That Can Hold Every Possible Position in A
File. Fgetpos () Returns ZERO UPON SUCCESS, AND A NON-ZERO VALUE UPON Failure.Reled Topics: fsetpos (), fseek (), ftell () fgetssyntax:
#include
WHEN It Reaches The end of a line, in which case str will be terminated with a newline. if fgets () Reaches Num - 1 Characters
OR Encounters the EOF, STR WILL BE NULL-TERMINATED. FGETS () Returns Str on success, and null on an error.fopensyntax:
#include
THE FOPEN () Function Opens A File Indicated by FName and Returns A Stream Associated with That File. If There is an error,
FOPEN () Returns Null. Mode Is Used To Determine How The File Will BE Treated (IE for Input, Output, etc) Mode Meaning "R" Open a Text File forread "W" Create a Text File for Writing "a" Append TO a TEXT FILE "RB" Open a binary file forread "wb" Create a binary File for Writing "ab" append to a binary file "r " Open a text file forread / write "w " Create a Text File for Read / Write "a " Open A TEXT FILE for READ / WRITE "RB " Open A Binary File for Read / Write "WB " Create a Binary File for Read / Write "Ab " Open A Binary File for Read / Write
AN EXAMPLE:
Char ch; file * infut = fopen ("stuff", "r"); ch = getc (input);
FPrintfsyntax:
#include
.............................. ...Claizes.
FPRINTF () Works Just Like Printf () AS Far As The Format Goes The Return Value of Fprintf () Is The Numr of Charactersoutputted, or a NEGATIVE NUMBER IF An Error Occurs. AN EXAMPLE:
Char name [20] = "Mary"; file * out; out = fopen ("output.txt", "w"); if (out! = null) fprintf (out, "hello% s / n", name) ;
Related Topics: Printf (), fscanf () FPUTCSYNTAX:
#include
The function fputc () Writes The Given Character Ch To The Given Output Stream. The return value is the character, unless
There is an error, in which case the return value is eof.related topics: fgetc (), fopen (), fPrintf (), FREAD (), fwrite () fputssyntax:
#include
The fputs () Function Writes An Array of Characters Pointed to by Str To The Given Output Stream. The return value is
Non-Negative On Success, And Eof On Failure.Reled Topics: Fgets (), Gets (), PUTS (), FPRINTF (), fscanf () FREADSYNTAX:
#include
THE FUNCTION FREAD () READS NUMBER OF Objects (Where Each Object Is Size Bytes) And Places The Array Pointed To
BY BUFFER. The Data comes from the Given Input Stream. The return value of the function is the number of things ready ... USE OF SHING SIT ... USE NUMBER OF THINGS Read ... Use THE
FeOf () or ferror () to Figure out if an error occurs.related Topics: fwrite (), fopen (), fscanf (), fgetc (), getc () Freopensyntax:
#include
The Freopen () Function is used to reasonN an existing stream to a different file and mode. After a call to this function,
The Given File Stream Will Refer to Fname with Access Given By Mode. The return value of freopen () is the new stream, or nullif the an an error.related Topics: fopen (), fclose () fscanfsyntax:
#include
THE FUNCTION FSCANF () Reads Data from The Given File Stream in a manner exactly like scanf (). The return value of fscanf () IS
THE NUMBER OF VARIABLES THATE ACTUALLY Assigned Values, or EOF iF no assignments: scanf (), fprintf () fseeksyntax:
#include
The Function FSeek () Sets The File Position Data for The Given Stream. The Origin Value Should Have ONE of the FOLLOWING
VALUES (Defined In stdio.h): Name ExplanationSeek_set seek from the start of the fileseek_cur seeek from the current locationseek_end seek from the end of the file
FSeek () Returns Zero Upon Success, Non-Zero On Failure. You can use fseek () to move beyond a file, but not before the
Beginning. Using fseek () Clears The EOF FLAG Associated with That Stream.Related Topics: ftell (), rebos (), fopen (), fsetpos (), fsetpos () FSETPOSSYNTAX:
#include
................ ..
FPOS_T is defined in stdio.h. The return value for fsetpos () is Zero Upon Success, Non-Zero on Failure.Reled Topics: fgetpos (), fseek (), ftell () Ftellsyntax:
#include
The Ftell () Function Returns The Current File Position for stream, or -1 if an error ocurs.related Topics: fseek (), fgetpos () FWRITESYNTAX:
#include
Objects Written.Reled Topics: Fread (), FScanf (), getc (), FGetc () getCsyntax:
#include
THE getc () Function Returns the next character from stream, or eof if the end of file is reached. Getc () is identical to
Fgetc (). for example:
Char ch; file * infut = fopen ("stuff", "r"); ch = getc (input); while (ch! = EOF) {printf ("% c", ch); ch = Getc (input); }
Related Topics: FPUTC (), FGetc (), PUTC (), Fopen () getcharsyntax:
#include
The getchar () Function Returns the next character from stdin, or eof if the end of file is reached.related to ipics: fputc (), fgetc (), PUTC (), fopen () getssyntax:
#include
The gets () Function Reads Characters from stdin and loads Them Into Str, UnTil A Newline or EOF Is Reached. The Newline
Character is translated into a null termination. The return value of gets () is the read-in string, or null if there is an
Error.Reled Topics: fputs (), fgetc (), fgets (), PUTS () PERRORSYNTAX:
#include
The perror () function prints str and an importation-defined Error Message Corresponding to the global variable errno.printfsyntax:
#include
THE PRINTF () Function Prints Output to Stdout, According to Format and Other Arguments Passed to Printf (). The string format
consists of two types of items - characters that will be printed to the screen, and format commands that define how the otherarguments to printf () are displayed Basically, you specify a format string that has text in it, as well as "special".
Characters That map to the Other arguments of printf (). for example, this code
Char name [20] = "bob"; int Age = 21; Printf ("Hello% S, You are% D Years OLD / N", Name, AGE);
Displays the folowing output:
Hello Bob, You are 21 years old
The% s means, "INSERT The First Argument, A String, Right Here." The% D INDICATES That The Second Argument (an inTeger)
SHOULD BE PLAECED THERE. There Are Different% -Codes for Different Variable Types, AS Well As Options To Limit The Length of
The Variable 4 and whatnet.code format% C Character% D Signed Integers% i Signed Integers% E Scientific Notation, with a LowerCase "E"% E Scientific Notation, with a uppercase "e"% f floating point% g USE% e OR % f, whichever is shorter% G use% E or% f, whichever is shorter% o octal% s a string of characters% u unsigned integer% x unsigned hexadecimal, with lowercase letters% X unsigned hexadecimal, with uppercase letters% p a Pointer% N the argument shaverto which is placed the number of character of characterswritten so far %% a '%' SIGN
An Integer Placed Between a% Sign and The Format Command Acts AS A MINIMUM FIELD WIDTH Specifier, and Pads the Output with
.
You can use a precision modifier, Which Has Different Meanings Depronding on the format code being used.
* WITH% E, And% F, The Precision Modifier Lets You Specify The Number of Decimal Places Desired. For example,% 12.6f
will display a floating number at least 12 digits wide, with six decimal places. * With% g and% G, the precision modifier determines the maximum number of significant digits displayed. * With% s, the precision modifer simply acts as a maximumfield length , to Complement the minimum field length That
Precedes the period.
All of printf () 's Output Is Right-Justified, UNSS You Place A Minus Sign Right After the% Sign. For Example,
% -12.4f
Will Display A Floating Point Number with a Minimum of 12 Characters, 4 Decimal Places, And Left Justified. You May Modify
THE% D,% i,% o,% u, and% x type specifiers with the letter l and the letter h to specify long and shring data type (E.g.% HD
Means a short integer. THE% E,% F, AND% G Type Specifiers Can Have The Letter L Before Them To Indicate That A Double
FOLLOWS. THE% G,% F, AND% e Type Specifiers Can Be Preceded with the character '#' TOSURE That The Decimal Point Will BE
Present, Even if there is no decimal digits. The use of the '#' Character with the% x type specifier indeicates That
Hexidecimal Number Should Be Printed with the '0x' Prefix. The Use of the '#' Character with the% o Type Specifier INDICATES
That The Octal Value Should Be Displayed With A 0 prefix.
You can Also include Constant Escape sequences in the output string.
THE RETURN VALUE OF Printf () Is The Numr Of Characters Printed, or a NEGATIVE NUMBER IF An Error Occurred.Reled Topics: Scanf (), FPRINTF () PUTCSYNTAX:
#include
The Putc () Function Writes The Character Ch To Stream. The Return Value Is The Character Written, or EOF IF IHERE IS ANERROR. For example:
Char ch; file * input, * output; input = fopen ("tmp.c", "r"); output = fopen ("tmpcopy.c", "w"); ch = Getc (input); while (chile) ! = EOF) {PUTC (CH, OUTPUT); CH = Getc (INPUT);} fclose (input); fclose (Output);
GENERATES A COPY OF THE FILE TMP.C Called Tmpcopy.c.Reled Topics: Fgetc (), FPUTC (), getchar (), PUTCHAR () PUTCHARSYNTAX:
#include
The Putchar () Function Writes Ch To Stdout. The Code
PUTCHAR (CH);
Is the Same as
PUTC (CH, STDOUT);
The return value of putchar () is The Written Character, or EOF IF IS An Error.Reled Topics: PUTC () Putssyntax:
#include
The function puts () WRITES STR TO STDOUT. PUTS () Returns Non-Negative ON Success, or EOF ON Failure.Reled Topics: PUTC (), gets (), Printf () RemoveSyntax:
#include
The remove () Function Erases the file specified by fname. The return value of remove () IS ZERO UPON SUCCESS, AND NON-ZERO IF
There is an error.related Topics: rename () RenameSyntax:
#include
THE FUNCTION RENAME () CHANGES The name of the file oldfname to newfname. The return value of rename () is Zero Upon Success,
Non-Zero On Error.related Topics: Remove () REWINDSYNTAX:
#include
THE FUNCTION REWIND () MOVES The File Position Indicator To The Beginning of The Specified Stream, Also Clearing The Error and
EOF Flags Associated with That Stream.Reled Topics: fseek () scanfsyntax: #include
The scanf () Function Reads Input from stdin, According to the Given Format, and Stores The Data in The Other Arguments. IT
Works a lot like printf (). The Format String Consists of Control Characters, Whitespace Characters, And non-white
Characters. The Control Characters Are Precededed by a% Sign, And Are As Follows: Control Character Explanation% C A Single Character% D A Decimal Integer% I An Integer% E,% F,% G A floating-point number% o AN Octal Number% s A string% x a hexadecimal number% P a pointer% n an integer equal to the number of character in characters read so far% u An unsigned integer [] a set of characters %% a percent sign
Scanf () Reads The Input, Matching The Characters from Format. When a Control Character Is Read, IT Puts The Value in The Next
Variable. Whitespace (Tabs, Spaces, etc) Are Skipped. Non-Whitespace Characters Are Matched to The Input, Then Discarded. IF
A Number Comes Between THE% Sign and The Control Character, The Only That Many Characters Will Be Converted Into The
Variable. if scanf () Encounters a set of character [] Control Character, THEN Any Characters Found Wtem
The Brackets Are Read Into The Variable. The Return Value of Scanf () Is The Number of Variables That Wee SuccessFully
Assigned Values, or EOF if there is an error.related topics: printf () and fscanf (). setbufsyntax:
#include
The setbuf () Function Sets Stream To Use Buffer, OR, IF Buffer IS NULL, TURNS OFFERING. IF A NON-Standard Buffer Size IS
Used, IT Should by Bufsiz Characters Long.related Topics: Fopen (), Fclose (), SetVBUF (), Setvbufsyntax: #include
The function setvbuf () Sets The Buffer for Stream To Buffer, with a size of size. Mode can be:
* _Iofbf, Which indeicates full buffering * _iolbf, Which means line buffering * _ionbf, Which means no buffering
Related Topics: SetBuf (), Sprintfsyntax:
#include
THE SPRINTF () Function is Just Like Printf (), Except That The Output is Sent To Buffer. The Return Value Is The Number of
Characters Written. for example:
Char string [50]; int file_number = 0; sprintf (string, "file.% d", file_number); file_number ; output_file = fopen (String, "W");
Related Topics: Printf (), fsprintf (), SSCANFSYNTAX:
#include
The function sscanf () IS JUST LIKE Scanf (), Excepter That The Input is read from buffer.related Topics: scanf (), fscanf (), TMPFILESYNTAX:
#include
The function tempfile () Opens a Temporary File with an unique filename and returns a pointer to thing file. If there is an
Error, NULL IS RETURNED.RED TOPICS: TMPNAM (), TMPNAMSYNTAX:
#include
TmpNam () Function Creates An Unique FileName and Stores It in Name. TmpNam () Can Be Called Up To TMP_MAX Times.Reled Topics: TMPFile (), Ungetcsyntax:
#include
The function ungetc () puts the character ch back in stream.Related topics: getc (), vprintf, vfprintf, and vsprintfSyntax: #include
Thase Functions Are Very Much Like Printf (), FPRINTF (), and Sprintf (). The Difference Is That The Argument List Is a Pointer
To a list of arguments. va_list is defined in stdarg.h, and is also used by va_arg (). for example:
Void Error (Char * fmt, ...) {va_list args; va_start (args, fmt); fprintf (stderr, "error:"); vfprintf (stderr, fmt, args); fprintf (stderr, "/ n") ; Va_end (args); exit (1);
===================================================== Standard C String & CharacteratOfsyntax :
#include
THE FUNCTION ATOF () Converts Str Into A Double, The Returns That Value. Str Must Start with a Valid Number, But Can Be
Terminated with any non-numeric Character, Other Than "E" or "e". for example,
X = ATOF ("42.0is_the_answer");
Results in x being set to 42.0.related topics: atoi () And atol (). ATOISYNTAX:
#include
THE ATOI () Function Converts Str Into An Integer, And Returns That Integer. Str Should Start with Some Sort of Number, And
ATOI () Will Stop Reading from Str As Soon A Non-Numeric Character Has Been Read. for Example, I = ATOI ("512.035");
Would Result In I Being Set To 512.Reled Topics: ATOF () And atol (). atolsyntax:
#include
THE FUNCTION ATOL () Converts Str Into a long, Then Returns That Value. Atol () Will Read from Str Until It Finds Any Character
That Should Not Be in a long. The resulting truncated value is the resulting truncated value. for example,
X = atol ("1024.0001");
Results in x being set to 1024l.related Topics: ATOF () And atoi (). IsalnumSyntax:
#include
THE FUNCTION ISALNUM () RETURNS NON-ZERO if ITS ARGUMENT IS A NUMERIC DIGIT OR A Letter of The Alphabet. OtherWise, Zero IS
Returned.
Char C; scanf ("% c", & c); IF (isalNum (c)) Printf ("You Entered the alphapleric character% C / N", C);
Related Topics: Isalpha (), ISCNTRL (), ISDITI (), ISGRAPH (), isprint (), ISPUNCT (), and Isspace (). Isalphaasyntax:
#include
........................ ..
Char C; Scanf ("% C", & C); IF (isalpha (c)) Printf ("You Entered a letter of the alphabet / n");
Related Topics: IsalNum (), ISCNTRL (), ISDIGIT (), ISGRAPH (), isprint (), ISPUNCT (), and ISSPACE (). ISCNTRLSYNTAX:
#include
The ISCNTRL () Function Returns Non-Zero if ITS Argument Is A Control Character (BetWeen 0 and 0x1f or Equal to 0x7f).
Otherwise, Zero Is Returned.Reled Topics: Isalnum (), Isalpha (), ISDIGIT (), ISGRAPH (), ISPRINT (), ISPUNCT () (), Isspace (). IsdigitsynTax: #include
The function isdigit () Returns Non-Zero if iten 0 and 9. OtherWise, Zero is returned.
Char C; Scanf ("% C", & C); IF (Isdigit (c)) Printf ("You Entered the Digit% C / N", C);
Related Topics: Isalnum (), Isalpha (), ISCNTRL (), ISGRAPH (), isprint (), ISPUNCT (), and Isspace (). ISGRAPHSYNTAX:
#include
THE FUNCTION ISGRAPH () Returns Non-Zero if ITS Argument is any printable character Other Than a space (if you can see the the
CHARACTER, THEN ISGRAPH () WILL RETURN A NON-ZERO VALUE). Otherwise, Zero Is Returned.Reled Topics: Isalnum (), Isalpha (), ISCNTRL (), Isdigit (), ISPRINT (), ISPUNCT (), And Isspace () .slowersyntax:
#include
The islower () Function Returns Non-Zero if ITS Argument is a Lowercase Letter. OtherWise, Zero is Returned.Reled Topics: Isupper () isprintsyntax:
#include
The function isprint () Returns Non-Zero if ITS Argument is a cotable character (include). OtherWise, Zero IS
Returned.Reled Topics: Isalnum (), Isalpha (), ISCNTRL (), ISDIGIT (), ISGRAPH (), ISPUNCT (), and Isspace (). ISPUNCTSYNTAX:
#include
.
Otherwise, Zero Is Returned.Reled Topics: Isalnum (), Isalpha (), ISCNTRL (), ISDITI (), ISGRAPH (), isprint (), and issspace (). IsspaceSyntax:
#include
The isspace () function returns non-zero if its argument is some sort of space (ie single space, tab, vertical tab, formfeed, carriage return, or newline) Otherwise, zero is returned.Related topics:. Isalnum (), isalpha (), ISCNTRL (), ISDIGIT (), ISGRAPH (), and ispunct (). Isuppersyntax:
#include
THE ISUPPER () Function Returns Non-Zero if ITS Argument is an uppercase letter. Otherwise, Zero is returned.related topics: TOLOWER () isxdigitsyntax:
#include
The function isxdigit () Returns Non-Zero if ITS Argument is a hexidecimal Digit (i.e. A-f, A-f, or 0-9). Otherwise, Zero IS
Returned.Reled Topics: Isalnum (), Isalpha (), ISCNTRL (), ISDIGIT (), ISGRAPH (), ISPUNCT (), and Isspace (). Memchrsyntax:
#include
THE MEMCHR () Function Looks for the First Occurrence of Ch Withnin Count Characters in The Array Pointed to by Buffer. The
Return Value Points to the Location of the First Occurrence of Ch, or Null IF Ch Isn't Found. For example:
Char names [] = "Alan Bob Chris X Dave"; IF (Memchr (Names, 'X', Strlen (Names)) == NULL) Printf ("DIDN't Find AN X / N"); Else Printf ("" Found AN X / N ");
Related Topics: Memcpy () and strsTr (). Memcmpsyntax:
#include
. The function memcmp () compares the first count characters of buffer1 and buffer2 The return values are as follows: Value Explanationless than 0 buffer1 is less than buffer2equal to 0 buffer1 is equal to buffer2greater than 0 buffer1 is greater than buffer2
Related Topics: Memchr (), Memcpy (), and strcmp (). Memcpysyntax: #include
THE Function Memcpy () Copies Count Characters from The Array from To The Array To. Memcpy () Returns To. The Behavior of
Memcpy () is undefined if to and from overlap.related Topics: Memmove (). MemmoveSyntax:
#include
THE MEMMOVE () Function Is Identical To Memcpy (), Excepter That IT Works Even if to and from overlap.related Topics: memcpy (). Memsetsyntax:
#include
THE FUNCTION MEMSET () COPIES Ch INTO The First Count Characters of Buffer, And Returns Buffer. Memset () IS USEful for
Intializing a section of memory to some value. for example, this command:
MEMSET (THE_ARRAY, '/ 0', SIZEOF (THE_ARRAY);
IS a VERY Efficient Way To Set All Values of the_Array to Zero.related Topics: Memcmp (), Memcpy (), and memmove (). Strcatsyntax:
#include
The strcat () Function Concatenates str2 ONTO The End of str1, and returns str1. For example:
Printf ("Enter Your Name:"); scanf ("% s", name); title = strcat (name, "the great"); Printf ("Hello,% S / N", Title);
Related Topics: strChr (), strcmp (), and structax (). Strchrsyntax:
#include
THE FUNCTION STRCHR () RETURns a Pointer To The First Occurence of Ch in Str, or Null If Ch Is Not Found.Reled Topics: Strpbrk (), Strspn (), strstr (), and stratok (). Strcmpsyntax:
#include
For example:
Printf ("Enter Your Name:"); Scanf ("% S", Name); if (StrCMP (Name, "Mary") == 0) Printf ("Hello, Dr. Mary! / N");
Related Topics: Memcmp (), Strchr (), STRCPY (), and strncmp (). Strcollsyntax:
#include
THE STRCOLL () Function Compares str1 and str2, much like strcmp. However, strcoll () Performs the Comparison Using The Locale
Specified by the setlocale () Function.StrcPysyntax:
#include
THE STRCPY () Function Copies Characters in the string from to the string to, incruding the null termination. The return value
Is to.Reled Topics: Memcpy (), STRCHR (), STRCMP (), Strncmp (), and strncpy (). STRCSPNSYNTAX:
#include
THE FUNCTION STRCSPN () RETURns The index of the first character in str1 That matches any of the characters in str2.related Topics: Strrchr (), strpbrk (), strr (), and stratok (). STRERRORSYNTAX:
#include
The function strerror () Returns an "Implementation Defined String Corresponding to Num." Strlensyntax:
#include
The strlen () function returns the length of str (determined by the number of characters before null termination) .Related topics: memcpy (), strchr (), strcmp (), and strncmp () strncatSyntax:. #Include
THE FUNCTION STRNCAT () Concatenates At MOST CHARACTERS OF STR2 ONTO STR1, ADDING A NULL TERMINATION. The Resulting
String is returned.related topics: strcat (), strnchr (), strncmp (), and strncpy (). Strncmpsyntax:
#include
The strncmp () function compares at most count characters of str1 and str2 The return value is as follows:. Return value Explanationless than 0 str1 is less than str2equal to 0 str1 is equal to str2greater than 0 str1 is greater than str2
If The Comparison Will Stop After The First Null Termination IS
Encountered.Reled Topics: strcmp (), strnchr (), and strncpy (). STRNCPYSYNTAX:
#include
THE STRNCPY () Function Copies at MOST Count Characters of from To The String To. If From Has Less Than Count Characters, THE
Remainder is Padded with '/ 0' Characters. The return value is the resulting string.related payics: memcpy (), strchr (), strncat (), and strncmp (). StrPBRKSYNTAX:
#include
THE FUNCTION STRPBRK () RETURns a Pointer To The First Ocurrence In str2, or nulliff in
Present.Reled Topics: strspn () (), Strrchr (), strstr (), and stratock (). Strrchrsyntax:
#include
#include
THE STRSPN () Function Returns The Index of The First Character in str1 tr2.related topics: strpbrk (), strrchr (), strstr (), strrchr (), strstr (), strrchr (), strsTRSYNTAX:
#include
THE FUNCTION STRSTR () RETURns a Pointer To The First Occurrence of Str2 in str1, or null if no match is found.related Topics: strchr (), strcspn (), strpbrk (), strspn (), strpbrk (), strspn (), strpbrk (), Strrchr ( STRTODSYNTAX:
#include
The Function Strtod () Returns WhatVer It Encounters First in Start As A Double. End Is Set To Point At Whatver IS LEFT IN
START AFLOW OCCURS, STRTOD () Returns Either HUGE_VAL OR - Huge_Val.Reled Topics: ATOF () STRTOKSYNTAX:
#include
The Strtok () Function Returns a Pointer to the next "token" in str1, where str2 contains the delimiters That Determine THE
Token. Strtok () Returns Null if no token is found. in Order to Convert a String To Tokens, The First Call To Strtok () Should
.
For example:
Char str [] = "now # is the time for all # good men to come to the # aid of their country; char delims [] =" # "; char * result = null; result = str, Delims While (Result! = Null) {Printf ("Result IS /"% s / "/ n", result); result = strtok (null, delims);} The Above Code Will Display the Following Output:
Result IS "now" Result is "Good men to come to the" Result is "Aid of their country"
Related Topics: Strchr (), STRCSPN (), Strpbrk (), Strrchr (), and strsPN (). STRTOLSYNTAX:
#include
THE STRTOL () Function Returns Whatver IT Encounters First in Start As A Long, Doing The Conversion To Base if Necessary. End
IS set to point to what for the long. if The result can not be represented by a long, damol ()
Returns Either long_max or long_min. zero is returned upon error.Reled Topics: atol (). StrtoulSyntax:
#include
THE Function Strtoul () Behaves Exactly Like Strtol (), Except That It Returns An Unsigned Long Rather Than A Mere Long.related Topics: Strtol () StrxFrmsyntax:
#include
The strxfrm () Function Manipulates The First Num Characters of str2 and stores the result is self hat if a
Strcoll () Is Performed on str1 and the old str2, you will get the Same result as with a strcmp (). Related Topics: strcmp (), strcoll (), TOLOWERSYNTAX:
#include
The function tolower () Returns The Lowercase Version of the Character Ch.Reled Topics: TouPper (), TouPPersyntax:
#include
The Toupper () Function Returns The Uppercase Version of the Character Ch.Reled Topics: TOLOWER (), ============================= ================ Abssyntax:
#include
The ABS () Function Returns The Absolute Value of Num. For example:
INT MAGIC_NUMBER = 10; COUT << "Enter a Guess:"; CIN >> X; COUT << "Your Guess WAS" << ABS (Magic_Number - x) << "Away from The Magic Number." << endl;
Related Topics: Labs (). Acossyntax:
#include
The acos () Function Returns The Arc Cosine of Arg. Arg Should Be Between -1 and 1.Reled Topics: Asin (), Atan (), Atan2 (), Sin (), Cos (), Tan (), SINH ( ), cosh (), and tanh (). Asinsyntax:
#include
The asin () Function Returns The Arc Sine of Arg. Arg Should Be Between -1 and 1.Reled Topics: ACOS (), Atan (), Atan2 (), SIN (), COS (), Tan (), SINH ( ), cosh (), and tanh (). Atansyntax:
#include
THE Function Atan () Returns The Arc Tangent of Arg.related Topics: Asin (), ACOS (), Atan2 (), Sin (), Cos (), Tan (), SINH (), Cosh (), and Tanh ( ) .atan2syntax:
#include
THE ATAN2 () Function Computes The Arc Tangent of y / x, using the signs of the arguments to compute the quadrant of the return
Value.Reled Topics: Asin (), ACOS (), Atan (), SIN (), Cos (), Tan (), SINH (), Cosh (), and Tan (). CEILSYNTAX: #include
The CEIL () Function Returns The Smallst Integer No Less Than Num. For Example,
Y = 6.04; x = ceil (y);
Would Set X to 7.0.related Topics: floor () and fmod (). Cossyntax:
#include
THE COS () Function Returns The cosine of arg, Where arg is expressed in radians.related Topics: Asin (), ACOS (), Atan () (), ATAN2 (), Tan (), SINH (), COSH (), and tanh (). Coshsyntax:
#include
THE FUNCTION COSH () Returns The Hyperbolic Cosine of Arg.Reled Topics: Asin (), ACOS (), Atan () (), ATAN2 (), Tan (), SINH (), COS (), and Tanh ( ) .divsyntax:
#include
The Function Div () Returns The Quotient and RemainDer of the Operation Numerator / Denominator. The Div_t Structure IS
Defined in stdlib.h, And Has At Least:
INT quot; // the quotient int remote; // the remainder
For Example, The Following Code Displays The Quotient and RemainDer of X / Y:
DIV_T TEMP; TEMP = DIV (X, Y); Printf ("% D Divided BY% D Yields% D with a remainder OF% D / N", X, Y, Temp.quot, Temp.Rem);
Related Topics: LDIV (). EXPSYNTAX:
#include
THE EXP () Function Returns E (2.7182818) raised to the argth power.related topics: log (). Fabssyntax:
#include
THE FUNCTION FABS () Returns The Absolute Value of Arg.Reled Topics: ABS (). Floorsyntax:
#include
THE FUNCTION FLAREST INTEGER NOT GREATER THAN Arg. For Example, Y = 6.04; x = floor (y);
Would Result In x Being set to 6.0.related topics: ceil (). fmodsyntax:
#include
THE FMOD () Function Returns the remain of x / y.related topics: CEIL (), floor (), and fabs () .Frexpsyntax:
#include
The function frexp () is buy to decompose Num Into Two Parts: a mantissa between 0.5 and 1 (Returned by the function) and an an
Exponent Returned As Exp. Scientific NOTATION WORKS LIKE THIS:
Num = mantissa * (2 ^ exp)
Related Topics: LDEXP (). Labssyntax:
#include
The function labs () Returns the Absolute value of num.related Topics: ABS (). LDEXPSYNTAX:
#include
The ldexp () function returns Num * (2 ^ exp). And get this: if an overflow ivus, huge_val is returned.related topics: frexp () and modf (). Ldivsyntax:
#include
The ldiv () Function Returns the quotient and remainder of the Operation Numerator / Denominator. The ldiv_t structure is
Defined in stdlib.h and has at layast:
Long quot; // the quotient long remote; // the remainder
Related Topics: Div (). Logsyntax:
#include
The function log () Returns the Natural Logarithm of Num. There's a domain error if Num is negative, a Range error if Num IS
ZERO.Related Topics: log10 (). log10syntax:
#include
The log10 () Function Returns The Base 10 Logarithm for Num. There's A Domain Error If Num Is Negative, A Range Error IF Numis Zero.related Topics: log (). Modfsyntax:
#include
THE FUNCTION MODF () Splits Num ITO ITS ITEGER AND FRACTION Parts. It Returns The Fractional Part and Loads The Integer Part
INTO I.RELATED TOPICS: frexp () and ldexp (). Powsyntax:
#include
The Pow () Function Returns Base Raised to The Exp Power. There's A Domain Error if Base Is Zero and Exp is Less Than or Equal
To Zero. There's also a domain error if base is negative and exp is not an integer. There's a Range Error If there
Overflow.Reled Topics: Exp (), log (), and SQRT (). sinsyntax:
#include
THE Function Sin () Returns The Sine of Arg, Where Arg Is Given in Radians.Reled Topics: Asin (), ACOS (), Atan (), Cosh (), Atan2 (), Tan (), SINH (), COS (), and tanh (). SINHSYNTAX:
#include
The function sinh () returns the hyperbolic sine of arg.related Topics: Asin (), ACOS (), Atan (), Cosh (), Atan2 (), Tan (), SIN (), COS (), and Tanh ( ). SQRTSYNTAX:
#include
The SQRT () Function Returns The Square Root of Num. If Num Is Negative, A Domain Error Occurs.Reled Topics: Exp (), LOG (), and POW (). Tansyntax:
#include
THE TAN () Function Returns The Tangent of Arg, Where Arg Is Given in Radians.Related Topics: Asin (), ACOS (), Atan (), Cosh (), Atan2 (), Sinh (), SIN (), COS (), and tanh (). Tanhsyntax:
#include
THE Function Tanh () Returns The Hyperbolic Tangent of Arg.Reled Topics: Asin (), ACOS (), Atan (), Cosh (), Atan2 (), Tan (), SIN (), COS (), and Sinh ( ). ===================================================== Standard C Date & Timeasctimesyntax: #include
The function asctime () Converts The Time In The Struct Ptr To a Character String of The Following Format:
Day Month Date Hours: Minutes: Seconds Year / N / 0
AN EXAMPLE:
Mon Jun 26 12:03:53 2000
Related Topics: LocalTime (), GMTIME (), TIME (), and ctime (). ClockSyntax:
#include
The clock () Function Returns The Processor Time Since The Program Started, OR -1 IF That Information IS UNAVAILABLE. TO
Convert the return value to seconds, divide it by clocks_per_sec. (NOTE: IF Your Compiler Is Posix Compliant, Then
Clocks_per_sec is always defined as 1000000.) Related Topics: Time (), asctime (), and ctime (). CTIMESYNTAX:
#include
The ctime () Function Converts The Calendar Time Time To Local Time of The Format:
Day Month Date Hours: Minutes: Seconds Year / N / 0
Using ctime () is equivalent to
Asctime (LocalTime (TP));
Related Topics: LocalTime (), GMTIME (), TIME (), and asctime (). DiffTimeSyntax:
#include
THE FUNCTION DIFFTIME () Returns Time2-Time1, In Seconds.Reled Topics: LocalTime (), GMTIME (), Time (), and asctime (). GMTIMESYNTAX:
#include
The gmtime () function returns the given time in Coordinated Universal Time (usually Greenwich mean time), unless it's notsupported by the system, in which case NULL is returned Warning Related topics:.! Localtime (), time (), and asctime ( ) .localtimesyntax:
#include
THE Function LocalTime () Converts Calendar Time Time Into Local Time. Warning! Related Topics: GMTIME (), Time (), and asctime (). MkTimeSyntax:
#include
The mktime () Function Converts The Local Time In Time To Calendar Time, And Returns It. If it is an error, -1 is returned.related topics: time (), gmtime (), asctime (), and ctime (). StrftimeSyntax:
#include
The function strftime () formats date and time information from time to a format specified by FMT, THEN Stores The Result in
. Str (up to maxsize characters) Certain codes may be used in fmt to specify different types of time: Code Meaning% a abbreviated weekday name% A full weekday name% b abbreviated month name% B full month name% c the standard date and Time string% d day of the month, as a number (1-31)% h est, 24 hours format (0-23)% I Hour, 12 Hour Format (1-12)% j days of the year, as a Number (1-366)% M Month As a Number (1-12). NOTE: Some Versions of Microsoft Visual C May Use Values That Range from 0-11.% M Minute As a Number (0-59)% P Locale's Equivalent of am or pm% s second as a number (0-59)% u week of the year, sunday as the first day% w weekday as a decimal (0-6, sunday = 0)% W Week of the year, monday as the first day% x standard date string% X standard time string% y year in decimal, without the century (0-99)% Y year in decimal, with the century% Z time zone name %% a percent signThe strftime ( Function Returns The Number of Characters Put Into Str, or ZERO IF An Error Occurs.Related Topics: Time (), localtime (), and gmtime (). TimeSyntax:
#include
The function time () Returns the current time, or -1 if there is an error. If the argument time is given, then the current
Time is stored in time.related topics: localtime (), gmtime (), strftime (), ctime (), ======================== ==================== Standard C MemoryCallocSyntax:
#include
The calloc () function returns a pointer to space for an array of num objects, each of size size calloc () returns NULL ifthere is an error.Related topics:. Free (), malloc (), and realloc () freeSyntax.:
#include
The Free () Function Deallocates The Space Pointed to by Ptr, Freeing IT Up for Future Use. Ptr Must Have Been Used in A
Previous Call to Malloc (), Calloc (), or Realloc (). AN EXAMPLE:
TypedEf struct data_type {int Age; char name [20];} data; data * willy; willy = (data *) malloc (sloo); ... free (willy);
Related Topics: Calloc (), Malloc (), And Realloc (). Mallocsyntax:
#include
The function malloc () Returns a Pointer to a chunk of memory of size size, or null if there is an error. The memory pointed
To Will Be on the Heap, Not The Stack, So Make Sure To Free Ithen You Are Done with it. An example:
TYPEF STRUCT DATA_TYPE {Int Age; char name [20];} data; data * bob; bob = (data *) malloc (sizeof (data)); if (bob! = null) {bob-> agn = 22; strcpy (Bob-> Name, "Robert"); Printf ("% s IS% D Years OLD / N", BOB-> Name, Bob-> AGE);} Free (bob);
Related Topics: Free (), Realloc (), And Calloc (). ReallocSyntax:
#include
THE REALLOC () Function Changes the size of the object pointed to by Ptr to the given size. Size can be one size, lar
SMALLER THAN THE ORIGINAL. THE RETURN VALUE IS A Pointer To The New Space, or Null IF The IS An Error.Reled Topics: Free (), Malloc (), and Calloc (). =========== ============================================ Abortsyntax: #include
Terminates The current program. Depending on the impLementation, The Return Value Can Indicate Failure.Reled Topics: EXIT () And Atexit (). Assertsyntax:
#include
The assert () macro is buy to test for errors. If exp evataS to zero, assert () Writes information to stderr and exits the
Program. if the macro ndebug is defined, The assert () macros will be ignored.related topics: Abort () ATEXITSYNTAX:
#include
THE FUNCTION ATEXIT () Causes The Function Pointed to by Func To Be Called When The Program Terminates. You CAN Make Multiple
Calls to atexit () (at Least 32, Depending On Your Compiler) And Those Functions Will Be Called In Reverse Order of THEIR
ESTABLISHMENT () IS ZERO UPON SUCCESS, AND NONZERO ON FAILURE.RED TOPICS: EXIT () and Abort (). Bsearchsyntax:
#include
THE bsearch () Function Searches BUF [0] to buf [Num-1] for an item what matches key, using a binary search. The function
Compare sales, negative if it it it it its second, zero if equal, and positive if greater.
Items in the array buf shop be in assending order. The return value of bsearch () is a pointer to the matching item, or nullif none is found.related topics: qsort (). EXITSYNTAX:
#include
THE EXIT () Function Stops The Program. EXIT_CODE IS Passed On To Be The Return Value of The Program, Where Usually Zero
INDICES SUCCESS AND NON-ZERO INDICATES An Error.Reled Topics: Atexit () and Abort (). getnvsyntax:
#include
The Function GetENV () Returns Environmental Information Associated with name, and is very meansmentation dependent. Null IS
Returned if no information about name is available.related topics: system (). Longjmpsyntax:
#include
The function longjmp () causes the program to start executing code at the point of the last call to setjmp (). Envbuf is
USUALLY SET Through a call to setjmp (). status becomes the return value of setjmp () and can be used to Figure out where
LONGJMP () Came from. status shop not be set to zero.related topics: setjmp (). qsortsyntax:
#include
The Qsort () Function Sorts BUF (Which Contains Num Items, Each of Size Size Using Quicksort. The Compare Function IS Used To
Compare the items in buf. Compare shop returna, u, zero if the is
Equal, and Positive if the first argument is getting order. qsort () sorts buf in assending order.related topics: bsearch (). RaiseSyntax:
#include
The raise () function sends the specified signal to the program Some signals:. Signal MeaningSIGABRT Termination errorSIGFPE Floating pointer errorSIGILL Bad instructionSIGINT User presed CTRL-CSIGSEGV Illegal memory accessSIGTERM Terminate programThe return value is zero upon success, nonzero on failure.Related topics: signal () randsyntax:
#include
The function rand () Returns a pseudorandom Integer BetWeen Zero and Rand_max. AN EXAMPLE:
SRAND (TIME (NULL)); for (i = 0; I <10; i ) Printf ("Random Number #% D:% D / N", I, Rand ());
Related Topics: Srand () setjmpsyntax:
#include
The setjmp () Function SAVES The System Stack in Envbuf for use by a later call to longjmp (). When You First Call setjmp (),
ITS RETURN VALUE IS ZERO. LATER, WHEN You Call Longjmp (), The Second Argument of Longjmp () Is What The Return Value of
SetJMP () Will Be. confused? read about longjmp (). Related Topics: longjmp () Signalsyntax:
#include
THE SIGNAL () Function Sets Func to Be Called When Signal Is Recieved by Your Program. Func Can Be a Custom Signal Handler, OR
One of these macros (Defined in signal.h): macro explanationsig_dfl default signal handlingsig_ign ignore the signal
THE RETURN VALUE OF Signal () Is The Address of the Previously Defined Function for this Signal, or Sig_ERR Is there is an an
Error.srandsyntax:
#include
The function srand () is used to seed the Random sequence generated by rand (). For any given seed, rand () WILL Generate A
Specific "random" Sequence over and over again.
SRAND (TIME (NULL)); for (i = 0; I <10; i ) Printf ("Random Number #% D:% D / N", I, Rand ());
Related Topics: Rand (), Time (). SystemSyntax:
#include
The system () Function Runs The Given Command as a system call. The return value is usually zero if the commit execute
WITHOUT ERRORS. IF Command Is Null, System () Will Test To Seeiff The IS A Command Interpreter Available. Non-Zero Will Be
Returned if there is a commnd interpreter available, zero if not.related Topics: exit (), VA_ARGSYNTAX:
#include
The VA_ARG () Macros Are Used to Pass A Variable Number of Arguments to a function.
1. First, You Must Have a call to va_start () Passing a valid va_list and the mandatory first argument of the function.
THIS FIRST Argument Describes The Number of Parameters Being Passed. 2. Next, You Call Va_arg () Passing The VA_List and The Type of The Argument to Be Returned. The Return Value of Va_ARG ()
Is The Current Parameter. 3. REPEAT CALLS to VA_ARG () For However Many Arguments You Have. 4. Finally, a call to va_end () passing the va_list is necessary for Proper Cleanup.
For example:
Int sum (void) {int ANSWER = SUM (4, 4, 3, 2, 1); Printf ("THE ANSWER IS% D / N", Answer; Return (0 );} Int SUM (int Num, ...) {Int Answer = 0; VA_List Argptr; Va_Start (Argptr, Num); for (; Num> 0; Num--) Answer = VA_ARG (Argptr, int); VA_END (ARGPTR); Return (Answer);