Topic : Scanf() clrscr() getch() comments Explained


Visit Our Channel for Similar tutorials

Scanf
- It is predefined function which is declared in studio.h
- By using scanf function we can read the data from user.
- When we are working with scanf function it can take any no of arguments but first argument must be string constant & remaining argument seprated
- When we are working with scanf function within the double quotes we are required to pass proper format specifier only i.e. what type of data we are reading same type of format specifer is required.
- Scanf function work with the help of call by address mechanism thats why every variable requires & sign.

Clrscr
- It is predefined functions which is declared in conio.h, by using this function we can clear the data from console.
- Using clrscr is always optional, it is recommended to place a declaration part only.

Getch
- It is predefined function which is declared in conio.h by using this function we can read a character from keyword.
- Generally getch function we placing at end of the body because after printing the output, it can hold the screen until we are passing any character input.
NOTE- conio.h is compiler dependent header file i.e. all the compilers doesn't support conio.h header file.

Comments
When we are using comments in the program then that specific part of the program is ognored by compiler
Generally comments are used to provide the description about the logic.
In C language we have 2 types of comments

  • single line comment
  • multi line comment
Single line comment is given by // this symbols 
// this line wil be ignored by compiler because this is comment

Multi line comment is given by /* */ this symbols
/* this is multi line
comment
this all will be ignored by compiler
*/


Comments