C - Get Put
C - getchar() - Definition and Usage
- In C- Programming the getchar function is similar to the scanf statement, which will accept a character from the console file (console file is the output window where we can get the input values) or from a file, displays immediately while typing (after typing we need to press Enter key for proceeding).
C - putchar() - Definition and Usage
- In C- Programming the putchar function is similar to printf statement which will accept a character from the console file (console file is the output window where we can get the input values) or from a file, displays immediately while typing (after typing we need to press Enter key for proceeding).
C - gets() - Definition and Usage
- In C- Programming gets is similar to scanf statement which is used to scan a line of text from a standard input device.
- The gets () function will be terminated by a newline character.
- The newline character won't be included as part of the string.
- The string may include white space characters.
C - puts() Function - Definition and Usage
- The puts() function automatically inserts a newline character at the end of each string it displays, so each subsequent string displayed with puts() is on its own line.
- puts() returns non-negative on success, or EOF on failure.
- Uses of Puts() function in C :
- puts() is used to Print Message which is similar to printf statement in C .
- Asks the user for entering the data.
C - scanf() Function - Definition and Usage
- In C -Language, scanf() is a predefined function in "stdio.h" header file. It can be used to read the input value from the keyword.
- The format string must be a text enclosed in double quotes.
- It contains the information for interpreting the entire data for connecting it into internal representation in memory.
- Example : integer (%d) , float (%f) , character (%c) or string (%s).
C - printf() Function - Definition and Usage
- The printf function is not the part of the C language, because there is no input or output defined in C language itself.
- In C , 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 format specifier to display the value of an integer variable.
- Similarly, %c is used to display character, %f for float variable, %s for string variable, %lf for double and %x for hexadecimal variable.
- To generate a newline,we use “\n” in C printf() statement.