Programming & IT Tricks . Theme images by MichaelJay. Powered by Blogger.

Copyright

Facebook

Post Top Ad

Search This Blog

Post Top Ad

Responsive Ads Here

Archive

Post Top Ad

Contact


Editors Picks

Follow us

Post Top Ad

Fashion

Music

News

Sports

Food

Technology

Featured

Videos

Fashion

Technology

Fashion

Label

Translate

About

Translate

Sponsor

test

Weekly

Comments

Recent

Connect With us

Over 600,000+ Readers Get fresh content from FastBlog

About

Wednesday, March 19, 2014

DIFFERENT LIBRARY FUNCTION




1.            getchar( ): -
This function is used to read simply one character from standard input device. The format of it is:

variablename = getchar( ) ;

Here the variablename should be character type. For example,

char name;
            name = getchar ( ) ;

Here computer waits until you enter one character from the input device and assign it to character variable name. You have to press enter key after inputting one character, then you are getting the next result. This function is written in stdio.h file

2.            getche( ): -
This function is used to read the character from the standard input device. The format of it is:
           
            variablename = getche( ) ;

Here the variablename should be character type. For example,

            char name;
            name = getche( ) ;

Here computer waits until you enter one character from the input device and assign it to character variable name. In getche( ) function there is no need to press enter key after inputting one character but you are getting next result immediately while in getchar( ) function you must press the enter key. This getche( ) function is written in standard library file conio.h.

3.            getch( ): -
This function is used to read the character from the standard input device but it will not echo (display) the character, which you are inputting. The format of it is:
           
            variablename = getch( ) ;

Here the variablename should be character type. For example,

char name;
name = getch( ) ;

Here computer waits until you enter one character from the input device and assign it to character variable name. In getch( ) function there is no need to press enter key after inputting one character but you are getting next result immediately while in getchar( ) function you must press the enter key and also it will echo (display) the character which you are entering. This getch( ) function is written in standard library file conio.h.

4.            putchar( ): -
This function is used to print one character on standard output device. The format of this function is:
putchar(variablename) ;

Here the variable name should be character type. For example,

char name;
name=’p’;
putchar(name);

After executing the above statement you get the letter ‘p’ printed on standard output device. This function is written in stdio.h file.
5.            isalpha( ): -
This function is used to check whether the character is alphabet (A to Z) or not. The format of this function is:

returnvalue = isalpha(character) ;

Here the returnvalue should be int type. If your character is alphabet then it will return true (non-zero value) otherwise it will return false (zero value). Here you can pass either the character variable or character constant as argument. For example,

int returnvalue;
returnvalue = isalpha(‘a’) ;

Here the value of the returnvalue is non-zero since the ‘a’ is alphabet. This function is written in ctype.h file.

6.            isdigit( ): -
This function is used to check whether the character is digit (0 to 9) or not. The format of this function is:

returnvalue = isdigit(character) ;

Here the returnvalue should be integer type. If your character is digit then it will return true (non-zero value) otherwise it will return false (zero value). Here you can pass either the character variable or character constant as argument. For example,

int returnvalue;
returnvalue = isdigit(‘3’) ;

Here the value of the returnvalue is non-zero since the ‘3’ is digit. This function is written in ctype.h file.
7.            isalnum( ): -
This function is used to check whether the character is digit (0 to 9) or alphabet (A to Z). The format of this function is:

returnvalue = isalnum(character) ;

Here the returnvalue should be integer type. If your character is digit or alphabet then it will return true (non-zero value) otherwise it will return false (zero value). Here you can pass either the character variable or character constant as argument. For example,

int returnvalue;
returnvalue = isalnum(‘3’) ;

Here the value of the returnvalue is non-zero since the ‘3’ is digit. This function is written in ctype.h file.

8.            islower( ): -
This function is used to check whether the character is in lowercase (small a to z) or not. The format of this function is:

returnvalue = islower(character) ;

Here the returnvalue should be integer type. If your character is in lowercase then it will return true (non-zero value) otherwise it will return false (zero value). Here you can pass either the character variable or character constant as argument. For example,

int returnvalue;
returnvalue = islower(‘a’) ;

Here the value of the returnvalue is non-zero since the ‘a’ is in lowercase. This function is written in ctype.h file.

9.            isupper( ): -
This function is used to check whether the character is in uppercase (A to Z) or not. The format of this function is:

returnvalue = isupper(character) ;

Here the returnvalue should be integer type. If your character is in uppercase then it will return true (non-zero value) otherwise it will return false (zero value). Here you can pass either the character variable or character constant as argument. For example,

int returnvalue;
returnvalue = isupper(‘A’) ;

Here the value of the returnvalue is non-zero since the ‘A’ is in uppercase. This function is written in ctype.h file.

10.        tolower( ): -
This function is used to convert your character into lower case from uppercase. The format of this is:

returnvalue = tolower(character) ;

Here the returnvalue should be character type. For example,

char returnvalue;
returnvalue = tolower(‘A’) ;

Here the value of the returnvalue is ‘a’ after execution. If you are using character other then uppercase alphabet as argument then it is remain as it is after executing tolower( ) function. This function is written in ‘ctype.h’ file.

11.        toupper( ): -
This function is used to convert your character into uppercase from lowercase. The format of this is:

returnvalue = toupper(character) ;

Here the returnvalue should be character type. For example,

char returnvalue;
returnvalue = toupper(‘a’) ;

Here the value of the returnvalue is ‘A’ after execution. If you are using character other then lowercase alphabet as argument then it is remain as it is after executing toupper( ) function. This function is written in ctype.h file.

12.        isprint( ): -
This function is used to check whether the character is printable or not. Printable characters are alphabet (A to Z), digit (0 to 9), and special character ($, %, #, &, etc.) while control, alter, shift, bell, null character are non-printable character. The format of this function is:

returnvalue = isprint(character) ;

Here the returnvalue should be integer type. If your character is printable then it will return true (non-zero value) otherwise it will return false (zero value). Here you can pass either the character variable or character constant as argument. For example,

int returnvalue;
returnvalue = isprint(‘3’) ;

Here the value of the returnvalue is non-zero since the ‘3’ is printable character. This function is written in ctype.h file.

13.        ispunct( ): -
This function is used to check whether the character is punctuation mark (special character. Not space, digit, alphabet, and non-printable character). The format of this function is:

returnvalue = ispunct(character) ;

Here the returnvalue should be integer type. If your character is punctuation mark then it will return true (non-zero value) otherwise it will return false (zero value). Here you can pass either the character variable or character constant as argument. For example,

int returnvalue;
returnvalue = ispunct(‘$’) ;

Here the value of the returnvalue is non-zero since the ‘$’ is punctuation mark. This function is written in ctype.h file.

14.        isspace( ): -
This function is used to check whether the character is space character (horizontal tab, new line, vertical tab, form feed, carriage return, space) or not. The format of this function is:

returnvalue = isspace(character) ;

Here the returnvalue should be integer type. If your character is space character then it will return true (non-zero value) otherwise it will return false (zero value). Here you can pass either the character variable or character constant as argument. For example,

int returnvalue;
returnvalue = isspace(‘  ’) ;

Here the value of the returnvalue is non-zero since the ‘ ’ is space character. This function is written in ctype.h file.

No comments:
Write comments

Interested for our works and services?
Get more of our update !