Input Functions in C Programming Language

Input functions are the functions through which data is entered into the computer. These functions can feed the data from standard input device like keyboard to the computer. All types of data can be entered into the computer through these input functions.

Input Functions in C programming language are –

  1. getchar( ) – This function is used to input a single character from the keyboard. This function can only store character type data and no other data type can be stored through this function. This function will echo the character on the screen while inputting. This is buffered function.The general syntax is as-
    where v is the vairable of character type. for ex -
    char mn;
  2. getch( ) – This function is similar to the getchar( ) function. But this function does not echo the character on the screen. It stores the character into the computer’s memory . The general syntax is as-
  3. gets( ) – This function in C programming language can input a a complete character string from the keyboard to the computer’s memory. This function can include blanks and special characters in the string. It’s syntax is-
    char nm[80];
  4. scanf( ) – Scanf( ) function can input every type of data. Integer type, floating point, double precision and character data can be inputted through this function. To input data through this function different codes known as control codes or format codes are used to input data of different types. These codes are –

%d – Integer data
%f – float data
%lf – long float or double precision type data
%ld – long interger
%c – for single charater
%s – for string of characters
%u – unsigned integer

General syntax of scanf function is –

scanf("control strings",&v1,&v2,&v3,...&vn);

for ex-
char nm[15];
int a;
float b;
scanf("%s %d %f",nm,&a,&b);

Note that to read the string we don't need to use ' & ' (ampersand sign).
 Whereas it is necessary to use this sign will all other variables of
other data types

yashan has written 69 articles

2 thoughts on “Input Functions in C Programming Language

  1. Edisyah says:

    I can not thank you adequately for the posts on your web site. I know you’d put a lot of time and efofrt into them and hope you know how much I appreciate it. I hope I’ll do exactly the same for someone else at some point.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>