Hello World
This article will thoroughly explain and tell you the fundamentals of creating your very first C Program Hello World.
In C programming language or any other programming language, we have certain limits and set of rules called Syntax that we must follow in order to obtain our result.
In C programming language or any other programming language, we have certain limits and set of rules called Syntax that we must follow in order to obtain our result.
The compiler as we know translates our high level language (source code) into low level language (machine level) so that the computer can run the program.
The basic structure of a simple C Program is:
#include<...>
void main()
{
//A single comment
/* Multiple line
Content */
}
Here, the #include is used to call up an inbuilt library like stdio.h , conio.h , string.h , etc.
These libraries comes pre-installed into the IDE (Integrated Development Environment) like Turbo C, Visual C++, etc.
The main role of these libraries is to contain certain set of functions and macros which can be used in the same program while execution.
If you want to know that how you can install them on your PC or your smartphone then click here.
main() function is the most important function of any C Program, it is mandatory function which must be present in every C Program.
The curly brackets {} after main () enclose the the body or logic of your program.
Data type is the declaration of the type of data function is returning.
For eg.: In the above sample program, you will notice void just before main (). This means that the program is not returning any value and it's void. Similarly if the program should return a value, we will use int data type instead of void.
You can add comments into your program to beautify and make it more engaging.
★ To add single line comment, just type:
// Your comment
★ To add a multiple line comment, just type:
/* Your
Comment */
Note: Comments are ignored by the compiler the text in the comment section does not run in the shell.
Hello World
The Hello World program is given below:
#include<stdio.h>
#include<conio.h>
main()
{
//This comment will be ignored by compiler.
printf("Hello World");
/* printf is output function of C which gives your desired input as output after execution.
The basic syntax is printf("your text"); */
}
Conclusion
That's it for today, if you liked the video and article then please like, comment and subscribe to the YouTube channel and newsletter.
I'll see you guys in the next one.
I'll see you guys in the next one.
Post a Comment
What do you think?