- Related Questions & Answers
Working of C 'Hello World!' Program // Your First C Program In C, any line starting with // is a comment. Comments are intended for the person reading the code to better understand the functionality of the program. March 16, 2018 March 21, 2018 Tanmay Sakpal 0 Comments c, c programming, hello world program in c, programming, programming tutorials In this programming tutorials, we will see our very first Hello World Program in C and understand line by line what it means in a very simple and overview level.
- Selected Reading
C++ is a general purpose programming language that supports procedural, object-oriented and generic programming. C++ is a superset of C and all valid C programs are valid in C++ as well.
C++ supports object oriented programming with features such as data hiding, encapsulation, inheritance, polymorphism etc.
Let us see the first C++ program that prints Hello, World!.
Example
The output of the above program is as follows −
Output
The different parts of the above program are explained as follows.
Headers
There are different headers in C++, each of which contain information that is necessary in the program. The header is used in this program which provides basic input and output services for C++ programs.
Namespaces
Namespaces are a relatively recent addition to C++. The following line we saw above informs the compiler to use the std namespace −
main()
The program execution begins with the following line as the main() function is the entry point of any C++ program.
Output
The message “Hello, World!” is displayed on the screen using the following statement −
Here, cout is an object of the class ostream and is associated with the standard C output stream stdout.
Comments
Single line comments in C++ begin with //. They are used to make the program easier to understand and are ignored by the compiler. The following comment in the above program is to clarify the purpose of the cout statement to the programmers.
Dev C Tutorial Programmers
return
Dev C++ Tutorial Hello World 1
The termination of the main() function is signalled by the return(0); statement. After this, the value 0 is returned to the calling process.
Comments are closed.