Explanation of First C Program:-
--------------------------------------------------------------------------------1) #include<stdio.h>
2) #include<conio.h>
3) void main()
4) {
5) int a = 190;
6) clrscr();
7) printf("%d\n",a);
8) getch();
9) }
Explanation:-
--------------------------------------------------------------------------------
Line 1:
"stdio.h" is a header file. It is the abbreviation of Standard Input Output Header File. It contains the prototypes of printf() and scanf() functions.Line 2:
"conio.h" is a header file. It is the abbreviation of Console Input Output Header File. It contains the prototypes of clrscr() and getch() functions.
Line 3:
"void main()" => is the main function. Every C program has only and only one such function.
Line 4 and Line 9:
"{" => is called opening brace and "}" is called the closing brace. Between them, we write the statements of the function.They are used to enclose the statements of loops and conditional statements.
Line 5:
"int a;" => declares 'a' as a variable of integer data type, with a
value of 190. int is short word for integer. Notice the semi colon at the end, it is important.
Line 6:
"clrscr();" => is the short for "clear screen". It is used to clear the screen.
Line 7:
"printf("%d\n",a);" => This line uses printf function. The 'f' in printf stands for 'format'. %d is the format string to print integers.The 'a' after the comma is the variable 'a' which we declared in line 5. \n is an escape sequence used to insert a new line.
Line 8:
"getch()" => This line uses getch() function. 'getch()' stands for get character. It is a console oriented function.
No comments:
Post a Comment