Your First C Program

Your First C Program

As we know “Practice Makes ah Man Perfect“. So we try to do things practically more, rather than reading about them. And it’s very important in learning any language, you have to have practically skills. The coding should be on your fingers and logic’s in your mind.

So open your compiler and start writing the program. Let’s start with the basic program, which you will make in almost every language. Printing the “Hello World” on the screen. Let’s print out instead “Lightning Code” ( Website Promotion 😀 ).

Look Carefully the Program and Keep Observing ►►

#include
#include
 
void main()
{

   printf("Lightning Code");
   getch();   
}

There are many new things for you to know about in the program, lets start understanding them, One-By-One.

In every program of C, in the starting of program there will always be some headers file. Headers File are the files where the functions definition are stored.

As we use the printf() function, it’s definition is stored in the header file (.h is the type of file). So when we execute the program,  #include header file will include the definition of function printf();, which we used in our program, to make it understand by the computer itself.

And the definition of getch(); is stored in file. So we also include #include in our program.

The printf(); is used to print out any output on the screen. Anything in between double Quote(“) (“HERE”) will print out on the screen.

And the getch(); function keep hold the output screen till the user do not enter any key.

Remember every C program must have at least one or more than one function. And one function will always be main(). The type before main() is the type of value the function will return. We will learn about it later. Here to remember is, void means that function will not return any value.

And every function start with open brace { and end with close brace }.

◄◄Prev                                                                                                             Next►►

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

spreading the power of programming …

%d bloggers like this: