LOOSE TECH - C Programming Blog Online
Wednesday, 7 August 2013
How To Make Simple Hello Program With Explanation
//Program to print “Hello” with the meaning of each word
1. #include
2. #include
3. void main() 4. { 5. clrscr(); 6. printf("Hello"); 7. getch(); 8. }
Explanation:-
In this Program, we used some terms that are used in almost every program of C.
Let understand the meaning of these terms.
1.
#include<stdio.h>
#include
→
Is a preprocessor directive (here it is used for File Inclusion. Hence, it is called as file inclusion preprocessor directive.)
stdio.h
→
Is the name of standard input/output header file (.h extension represent that it is a header file.)
2.
#include<conio.h>
conio.h
→
Is a console input output header file. It manage the console i/o functions. Such as- printf is used to display output on the screen. And, scanf is used to read input from the user.
3.
void main()
void
→
Is the data type. It does not return any value.
Instead of void, we can also write 'int' but int return value. So, we have to write 'return 0;' before 'getch();' 0 indicates success.
main()
→
Represents a function. All statements that belong to program are written inside the main function.
4.
{}
{}
→
The statements written inside the main() function are enclosed within a pair of braces {}.
5.
clrscr();
clrscr()
→
Is used to clear the output screen.
;
→
Is used to terminate a statement.
6.
printf("Hello");
printf("Hello")
→
Is used to display output on the screen. This command displays 'Hello'.
7.
getch();
getch()
→
It accepts a character from user. Thus, it helps to the user to see output by waiting to enter a character from keyboard.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: only a member of this blog may post a comment.