Creating a simple c program in the code editor
A c program has an entry point and an exit point while executing the lines of code one by one. To complete a single line or statement we need to add ";" at the end of every line. You can type the code manually or if you are using "Visual Studio code " editor then you can use the extensions of c language to simplify and automate your code writing.
No create a file named "hello. c" or you can clone this repository with a folder named hello program, You can click on the link to learn about the repository:
https://github.com/swarupsahu08/cprogramming/tree/main/helloprogram
This article must be read after setting up your system for c programming and cloning the repository and writing the c code would be helpful and you would better understand this description by seeing the code in your code editor.
#include<stdio.h>
int main(){
printf("Namaste C programmers\n");
return 0;
}
Here in the above program, you can see the first line starts with "#include<stdio.h>". It is the symbol to include the header file or library named standard output input. It is the library that helps us to interact with the input and output of any program.
In the next line, you can see there is "int main(){ }" It is the point from where the execution of the program is started from the first curly brace to the next curly brace. Everything that needs to be executed in the program must be written inside the int main() function.
Inside the main() function there is "printf("H...")" , it is used to display the text written inside double quotes in the output section while executing the c file.
The next line has "return 0" which shows that int main() has properly been executed. It may not be necessary but it is advised to write it before the closing curly braces.
At last ,I want to say that go through the github repository to know about the basics of c programming and you can make changes and contribute to the project and support the project.