Recent Posts

Sunday 31 December 2017

Hello world in C



In the previous post we learnt How to write 'C' program and Structure of 'C' program.In this post we will learn how to print Hello world in 'C' programming language.We have learned lot of information about C language if you didn't read you can read here C TUTORIAL.Now its time to start first 'C' program to print "Hello world in C".This is the first program "Hello world" write when start any programming language.

Hello world in C program

This is a program to print "Hello world" in C programming language.


#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("Hello world");
getch();
}

Output:
Hello world

Explanation:

1. #include<stdio.h>: 
In C programming language every program must start with #include<stdio.h>.It is known as the preprocessor directive of C language.The C preprocessor is a program that process the source code before it passed to the C compiler.If we include this directives in our program then program is easy to read and modify. #include is used in C program for including the stdio.h header  file in C program.we can place directives anywhere in the program but most often they are placed at the beginning of the program.This processor directives do not require a semi colon at the end.

2. Void main():
This is the first statement of every 'C' program,without main() function 'C' program cannot be start.If we didn't include main() function in 'C' program then error will be occurred.so every 'C' program must start with main() function.Here void is a return data type of function.It means that the main() function will not return anything.

3.Clrscr();
This is the clrscr() function.This function is used to clear the screen.This function is used to clear the output of the previous output window.If we don't use this function in our program then output window will be messy.

4.Printf():
Printf is a function which used to print any text or value on the screen.The text you want to print is enclosed in  double quote.you can see the below example:
                                   printf("Hello world");
in the above example hello world will be printed.

4.getch();
This function is used to hold the output window.otherwise when you run your code it will display the output window just for a second so it is necessary to use it in our program.If we want to hold our  output screen.



I hope you will understand this post if you have any question then you can ask me in comments.

0 comments:

Post a Comment

Followers

Popular Posts

Categories

social media

Text Widget

Powered by Blogger.

About Me

My name is junaid khan and i am a full time blogger and author of a blog tutorial called tutorialpointsolution.

String function

In the previous post we learn about what is String .we know that string is a collection of two or more characters.In string we can store al...

Search This Blog

Technology

Adbox

Recent Post

Breaking

Recent In Internet

Comments

Facebook

Pages

Comments

Pages

Recent

Pages

Technology