How to run the first code in C language?

If you have just started learning C Program and want to write your first program.
If you are just a pure beginner and no nothing about C language. Read the article Introduction To C Language.
In a C Program, we have four basic sections on which we have to focus and write your code.

1. Link Section – In the Link section, we mainly include the header files that we need during the execution of the program. For Example: In the above image we added stdio.h and conio.h. Stdio.h is used to perform Data Input / output function. Conio.h is used to clear the screen or holding the screen for getting the input from the user.
2. Global Declaration – It is not the mandatory section of the program. Your program will run smoothly if you do not have this section. Global variables are the variables that have the scope over the whole program.
3. Main Section – It is the most important section of the program. All the statements through which we will manipulate the data and will get the required output. Everything is written in the main section.
4. Comments – It is very important to add comments in your code as it will increase your code readability and will make your program more effective.
Example – Structure of C Program
1 2 3 4 5 6 7 |
/* Structure of C Program */ #include<stdio.h> #include<conio.h> void main() { printf("Hello! Shout Coders..."); } |
This is the basic Structure Of the C Program. After knowing all the Concepts of C Program. Try yourself to make some of the basic programs in C Language. Some of the recommended programs are :
After reading the article, try to make these programs yourself and make some changes accordingly.
Recommended Posts –