"Hello, world!" program||hello world
This post will describe writing the first "hello world" C program using a compiler.Here i am using codeblocks as a compiler tool.You can use any other compiler if you want.A detailed post about various compilers will be given in the next blog post.
Here are few things that this post is all about.This post will be covering all the detailed explanation of how to:
- Write a c program:how to write the program in the compiler
- Its basic components:components here is mainly the syntanx and the function used in the program.
- How to compile and run the c program:this section will deal with compiling and running the program.I have include links for some compiler you can check out if you don't have any compiler.
- Output of the given program: as always in the last we are going to see the output of the given program on the screen.
This is the simplest program of the c language.The reason why i have included it here is as it is the first program of the c language and i want to provide information about c from the very beginning i,e the basics.
Now before we get down to our business of writing the program let's just first see the basic components i,e the basic syntax used in every c program and know about them in very short.A detailed study of each function will be updated in few days.Till then let just know about them.
As said basic component these are the main parts of a c program and almost every C program have all these component in it
If you dont want to see the basics the directly jump to the program.
As said basic component these are the main parts of a c program and almost every C program have all these component in it
If you dont want to see the basics the directly jump to the program.
Basic component to write any c program:-
As the name suggests it is used by compiler to process the source program before passing to it.
Here stdio.h stands for standard input output.It is a basic function used by the OS to understand about input and output of the program.
- main functon
It defines the whole body of the c program and the main program is written inside it.A detailed information about this function will be given in the future post.Till then just remember it is used to write the programs into.I
It is the syntax used in c programming that is used to get output of the program on the screen.
Also the return statement is used to return any value to the main function.
and the desired output is:
What are the various steps required in compiling and running any program?:
Here are the basic steps that are required in writing and executing the program:
In the upper steps the step no.2 and 3 are done in the compiler and how to use the compiler will be posted in the next blog post.
- writing the program
- compiling the program and to check for any errors.
- building and running the program
- getting the desired output.
In the upper steps the step no.2 and 3 are done in the compiler and how to use the compiler will be posted in the next blog post.
How to compile and run the program
There are various ways to compile and run the c program;
There are numerous of compiler present on the internet just go to any of them and download it.Write your program in the compiler and run the program to get desired output.
I am giving here link to download one of them which i prefer over the rest:
I am giving here link to download one of them which i prefer over the rest:
Also there are many online compiler present where you can directly create an online program and compile and run it.
Here is a link to one of the online compiler:
Here is a link to one of the online compiler:
Well i am attaching here a link to my video explaining how to write this program and execute it:-
.
Reference:-Internet(wikipedia)


Comments
Post a Comment