#include- will insert-header file, which is a collection of predefined functions.
Return data type– It will tell the compiler that what kind of data (int, float, double, char, void) will be returned after the compilation of program.
Main()- It is a special functions used by C system or compiler to tell that what is the starting point of program. There can be only one main function in a program.
/* */- This is used to comment a line to increase the understanding and readability
{ }- defines the body in which all the functions will be written.
In C to take the output on the screen we need to use predefined library function “printf” and take the input from the user “scanf”.
Format:
printf(“<format string>”,<list of vaiables>);
scanf(“<format string>”,<&variable);
Data Type | Size | Range | |
char | 1 byte | -128 to 127 or 0-255 | |
Int | 2 byte | -32768 to 32767 or 0-65535 | |
float | 4 byte | 1.2E-38 to 3.4E+38 | 6 decimal places |
double | 8 byte | 2.3E-308 to 1.7E+308 | 15 decimal places |
A variable in simple terms is a storage place that has some memory allocated to it. Basically, a variable used to store some form of data.
Difference b/w variable declaration and definition
The variable declaration refers to the part where a variable is first declared or introduced before its first use. A variable definition is a part where the variable is assigned a memory location and a value. Most of the time, variable declaration and definition are done together.