Input output statement in C

MuthuganeshS4 1,843 views 6 slides Dec 07, 2020
Slide 1
Slide 1 of 6
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6

About This Presentation

printf,scanf


Slide Content

Input output statement C S.Muthuganesh M. Sc ., B.Ed

scanf Usually input statement is used in C is scanf () Syntax scanf (“control string”, &v1,&v2,&v3,…& vn ); The control string must be a text enclosed in double quotes. It contains the data format of data being received. The ampersand & before each variable is an operator that specified the variable’s names address and connecting it into internal representation in memory. Example for control string : integer (%d) , float (%f) , character (%c) or string (%s).

Printf () printf () function is used to print the “character, string, float, integer, octal and hexadecimal values” onto the output screen. We use printf () function with  %d  , %f, %s forrmat specifier to display the value of an variable. To generate a newline,we use “\n” in printf () statement. Syntax printf (“ outputstring identifiers(like % s,%d )”, variablenames ); Example printf (“ hai hello%s ”,name);

getchar () getchar  is a function in C programming language that reads a single character. getchar () function is used to get/read a character from keyboard input. When this statement encountered the computer waits until key is pressed. Syntax Variable_name = getchar (); Example char name; name = getchar ();

putchar ()  putchar () function in C programming language which is used to write a character on standard output/screen. Syntax putchar ( variablename ); Example Choice=’y’; putchar (Choice);

Thank you