How to Create a C Program

Posted on Updated on


Before stating a C program we must have to include some header files which contains some lines of codes and inbuilt methods through which we can easily perform any task in a program and we can’t then we can create our own header file by coding and this will be discussed in further posts.

So, to include header files in c, we have to write something like this :-
#include<stdio.h>
#include<conio.h>

Where,
=> # is stands for the root directory,
=> include is stands for attaching a header file with program,
=> contains the name of header file with it’s extension .h

stdio.h is a stranded input-output header file,
math.h is for using inbuilt mathematical function in program like, sin, cos etc.

=> every program in c starts with main function and if you want to return some value as a output then you can use the data type of it in the beginning of main function like,
=> int main() -> Returns integer value.
=> void main() -> Returns nothing, not even zero.

Note :- if you have chosen a main function with return type then you must have to return some value in the end of main function like this,
return(5);, return(a); etc.

void main()
Program starts -> {

Program body where the lines of code is written.

Program ends -> }

More will be discussed in next post.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s