Friday, November 4, 2016

C Languge Miscellaneous Functions for BCA , BSc(IT) and PGDCA




Prepared By : Uday Shah - HOD (IT)
Contact No : 7600044051
-------------------------------------------------------------------------------------------
Delay()  
Delay in c: delay function is used to suspend execution of a program for a particular time.
Declaration :  void delay(unsigned int);
Here unsigned int is the number of milliseconds ( remember 1 second = 1000 milliseconds ). To use delay function in your program you should include the dos.h header file.

Clrscr()

It is a predefined function in "conio.h" (console input output header file) used to clear the console screen. It is a predefined function, by using this function we can clear the data from console (Monitor). Using of clrscr() is always optional but it should be place after variable or function declaration only.

isalpha
The C library function void isalpha(int c) checks if the passed character is alphabetic. ollowing is the declaration for isalpha() function.
int isalpha(int c);
c is the character to be checked. This function returns non-zero value if c is an alphabet, else it returns 0.


isalnum
The C library function void isalnum(int c) checks if the passed character is alphanumeric. Following is the declaration for isalnum() function.
int isalnum(int c);
c  is the character to be checked. This function returns non-zero value if c is a digit or a letter, else it returns 0.

isdigit
The C library function void isdigit(int c) checks if the passed character is a decimal digit character. Decimal digits are numbers − 0 1 2 3 4 5 6 7 8 9.
Following is the declaration for isdigit() function.
int isdigit(int c);
c  is the character to be checked. This function returns non-zero value if c is a digit, else it returns 0.
 
isgraph
The C library function void isgraph(int c) checks if the character has graphical representation. The characters with graphical representations are all those characters that can be printed except for whitespace characters like ' ', which is not considered asisgraph characters. Following is the declaration for isgraph() function.
int isgraph(int c);
c  is the character to be checked. This function returns non-zero value if c has a graphical representation as character, else it returns 0.
 
islower
The C library function int islower(int c) checks whether the passed character is a lowercase letter. Following is the declaration for islower() function.
int islower(int c);
c  is the character to be checked. This function returns a non-zero value(true) if c is a lowercase alphabetic letter else, zero (false).

isprint
The C library function int isprint(int c) checks whether the passed character is printable. A printable character is a character that is not a control character. Following is the declaration for isprint() function.
int isprint(int c);
c  is the character to be checked. This function returns a non-zero value(true) if c is a printable character else, zero (false).

isspace
The C library function int isspace(int c) checks whether the passed character is white-space.
Standard white-space characters are −
' '  space (SPC)
'\t' horizontal tab (TAB)
'\n' newline (LF)
'\v' vertical tab (VT)
'\f' feed (FF)
'\r' carriage return (CR)
Following is the declaration for isspace() function.
int isspace(int c);
c  is the character to be checked. This function returns a non-zero value(true) if c is a white-space character else, zero (false).



isupper
The C library function int isupper(int c) checks whether the passed character is uppercase letter. Following is the declaration for isupper() function.
int isupper(int c);
c  is the character to be checked. This function returns a non-zero value(true) if c is an uppercase alphabetic letter else, zero (false).
Toupper

The C library function int toupper(int c) converts lowercase letter to uppercase. Following is the declaration for toupper() function.
int toupper(int c);
c  is the letter to be converted to uppercase. This function returns uppercase equivalent to c, if such value exists, else c remains unchanged. The value is returned as an int value that can be implicitly casted to char.

tolower
The C library function int tolower(int c) converts a given letter to lowercase. Following is the declaration for tolower() function.
int tolower(int c);

c  is the letter to be converted to lowercase. This function returns lowercase equivalent to c, if such value exists, else c remains unchanged. The value is returned as an int value that can be implicitly casted to char.

Clearerr()
The C library function void clearerr(FILE *stream) clears the end-of-file and error indicators for the given stream. Following is the declaration for clearerr() function.
void clearerr(FILE *stream)
stream  is the pointer to a FILE object that identifies the stream.

Errno  

As such, C programming does not provide direct support for error handling but being a system programming language, it provides you access at lower level in the form of return values. Most of the C or even Unix function calls return -1 or NULL in case of any error and set an error code errno. It is set as a global variable and indicates an error occurred during any function call. You can find various error codes defined in <error.h> header file.
So a C programmer can check the returned values and can take appropriate action depending on the return value. It is a good practice, to set errno to 0 at the time of initializing a program. A value of 0 indicates that there is no error in the program.
The C programming language provides  perror()  and  strerror()  functions  which can be used to display the text message associated with errno.

Iscntrl
The C library function void iscntrl(int c) checks if the passed character is a control character.
According to standard ASCII character set, control characters are between ASCII codes. Specific compiler implementations for certain platforms may define additional control characters in the extended character set. Following is the declaration for iscntrl() function.
int iscntrl(int c);

c  is the character to be checked. This function returns non-zero value if c is a control character, else it returns 0.

isxdigit
The C library function int isxdigit(int c) checks whether the passed character is a hexadecimal digit. Following is the declaration for isxdigit() function.
int isxdigit(int c);


c  is the character to be checked. This function returns a non-zero value(true) if c is a hexadecimal digit else, zero (false).

:: Best Of Luck ::

Please give your comment and share it.... Thank you