main() scanf() printf()
What is main( )
Main () is a
function or we often say a set of statement in C program. It is the main
function in c program from where the compiling starts. The Main () is library
function so its name cannot be change.
What is printf()
It is the
instruction based keyword in C used to display output on the screen. It is a
library function. To be able to use printf() function, it is necessary to use #include<stdio.h>
header file this is done by typing the #include<stdio.h> at the
top of program.
The general
form of printf() function is:
Printf(“Type to print“);
What is scanf()
It is use to
grasp the value from user. It is necessary to use #include<stdio.h> header file this is done by typing the
#include<stdio.h> at the top of program.
The general
form of scanf() function is:
Scanf(“%d %f %c”,&a,&b,&c);
%d (used for
integers) %f (used for real) and %c (used for character) is used to indicate
the datatype which is written between “ “ and use & (ampersand) before
variables indicates the address of variables.
A scanf statement when scan two variables from user in a single statement
i.e.
scanf("%d,%d",&a,&b);
or
scanf("%d %d",&a,&b);
or
scanf("%d %d",&a,&b);
two data types are separated by space or comma or tab
No comments