C is mother of all programming languages.It is easy to learn,understand and code.It was developed by Dennis Ritchie.C is one of the most used programming language of all time.So lets start our journey in C with hello world program.It is just a tradition we start with this program in every programming languages.
I will assume throughout the blog that user has idea about how to compile a c program.It is not rocket science you need a compiler like Turbo c++,Borland C++ for windows and GCC for linux.Here it is our first program:
#include<stdio.h>
#include<conio.h>
void main()
{
printf("hello world");
getch();
}
Now explaining the code
# is called Preprocessor is used to include Header file in the program , will be used in every program.
INCLUDE is used to include the functions of Header file that is included.
STDIO.H is a header file, header file is a collection of predefined functions that make us easy to code.STDIO.H stand for Standard Input Output because it contain the function like scanf,printf that is used for input and output and .H extension is because it is a header file.
CONIO.H is also a header file that contain getch(); function which is used to hold the screen.
VOID is prototype of main() that means the program will return nothing.
MAIN() it is the main function which contain the program ,it will used in every program of c and c++.
{} program go through in this bracket.
PRINTF() this function is used to print on the screen.
; is terminator that means it tell computer that line is over,now move to next line.
GETCH() this function is a part of CONIO.H header file used to hold the screen.
I can understand You won't be able to get it all at first time, just practice and see other program, you will get the idea hoe easy it is.
No comments:
Post a Comment