Subscribe Us

header ads

Writing first program in c, Chapter Two

 Welcome to chapter two of C tutorial. In the first we have learn about c generally. Which was very short. But everyone can understand it.


    







Now in this chapter we directly shift to the first program.

Before writing a c program. You definitely have question that where I can run this program.
So the answer is you can run your C program at online compilers, on your mobile applications, on computer.


I will suggest that you should use the computer for writing a program.
Because day by day we will learn about the greater codes which are not possible to write in the mobile.


How to run a c program on computer?

If you know about it then great else I will tell you.
You need code editor and compiler for the program
For example in windows there is notepad code editor. Where you can run your program.
But I am honestly suggesting that you should use Visual Studio CODE for the programing.
Install VS CODE
You need to install the compiler (download and install this compiler to your computer)
firstly install vs code on your computer (click on install button to see the procedure of installation)



So you are writing the first c program.
Before writing a program you should you should know about the general structure or design of c program.
So let’s understand it.
                        Header files
                        Main function
                        Code
                       Termination
This are the steps in the general program. As we go forward we will go deeply. And this structure may be increase.
So here is your first program

Open VS code create your new file with extension .c
Now type this program as it’s
Now lets understand what happens here



#include<studio.h> is called as header file. Which includes the function like printf scanf return etc.
We will learn about this functions day by day.


Second line is int main ()
From here the program starts.
Or we can say that before main() function whatever we write are the requirements to the main function.

In the next the curly bracket opens ({})
Always remember that your function should be in curly brackets.

Next is printf(“Hello World”);

Printf is a function used to printf.
Whatever we write the double quotes. Printf prints,

Printf function is terminated by the semicolon.(;)
Semicolons are also the important parts in the C language.
Last is return 0;
Return terminates the int main program and return 0 value.

So this was our first program.
Now one quiz for you.
Print your name in c program.
You can comment it or you can send it on my whatsapp number 7620529876.
I will give review on your programs and will also adds your names to the next chapter.


Post a Comment

0 Comments