Recents in Beach

Hello World in C - Display Hello World in turbo c++

Here we will write two C programs to display Hello World in c on Screen . In the first program we are displaying the message using printf function and in the second program we are calling a user defined function and that function displays the Hello World message on the screen.

Example 1: Displaying Hello World in C using printf

#include <stdio.h>
int main()
   printf("Hello World in c");
   return 0;


Hello World in c

1. #include <stdio.h> – This statement tells compiler to include this stdio.h file in the program. This is a standard input output file that contains the definitions of common input output functions such as scanf() and printf(). In the above program we are using printf() function.

2. int main() – Here main() is the function name and int is the return type of this function. Every C program must have this function because the execution of program begins with the main() function. The 0 return value of this function represents successful execution of program while the return value 1 represents the unsuccessful execution of program. This is the reason we have return 0; statement at the end of this main function.

3. printf("Hello World in c") – This function displays the content within double quotes as it is on the screen.

4. return 0; – As mentioned above, the value 0 means successful execution of main() function.

you can compile the code hello world program in turbo c++ and in gcc you will get the same result

Example 2: Hello World Program in c using Functions

Lets see the same program using user defined function. In this program we have created a function print() that prints the message Hello world on the screen. We are calling this function in the main() function,inside the function we passes the string "Hello World in c under" double quotation to Display message Hello World. To understand user defined functions, read this guide: User Defined Function in C.

void print(){
	printf("Hello World in c");
int main()
   return 0;

Recommended Book Must Buy :

To improve your skill and Knowledge you must read Let Us C 16TH EDITION  because this book is totally recommended for beginners and you can improve your skills by attempting example and question inside it 

Note : If you want this book with solution . what you have to do is to click here .

In this way we can print the message on the screen using Turbo c & code blocks , In this guide we printed the message Hello world in c but you can print your name string using the concept described above

Check out these related C programs:

  1. C Program to print number entered by user
  2. C Program to check whether the number is even or odd
  3. C Program to arrange numbers in the ascending order
  4. print hello world in c++

Post a Comment