Skip to main content

Hello World Program in C

Programming Languages

Welcome to coding world

Hello World Program in C

Here we will write two C programs to display Hello World on the 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

#include <stdio.h>

int main()

{

   /* printf function displays the content that is

    * passed between the double quotes.

    */

   printf("Hello World");

   return 0;

}

Output:

 

Hello World

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"); – 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.

Popular posts from this blog

Key Ecommerce Leader (KEL) Pakistan Awards Event 2024 | Pakistan KEL Awards Winner Tayyub Hussnain (Norwich Street Wear) | 2024 Alibaba.com Pakistan Key E-commerce Leader Winner

 Key Ecommerce Leader (KEL) Pakistan Awards Event 2024 On August 20, 2024, Alibaba.com organized an exceptional event at the Pearl Continental Hotel in Lahore. Participants gained insights into global business strategies and discovered the vast opportunities available through Alibaba.com. In an exciting development, Alibaba.com announced the launch of Trade Assurance in Pakistan by the end of August 2024, representing a significant advancement for the Pakistani market. Featured speakers included: 🌟 Andrew Zheng - Vice President, Alibaba.com 🌟 Vianne Wang - Head of Global Supply Chain, Alibaba.com 🌟 Winni Chen - Merchant Development Manager The event was a resounding success, enhancing confidence in the future of eCommerce in Pakistan! 💪🎉 During the event, six successful business owners were invited to share their stories and insights. Mr.Tayyub Hussnain stood out with his inspiring success story and impressive leadership skills, captivating the audience and judges alike. Ho...

Pakistan celebrities real ages 2021

  Pakistani Celebrities Ages 2021 A few celebrities hide their age since they have to be shape us get it that they are still energetic. So let’s take a see at the Veritable Age of Pakistani Celebrities and see which celebrity ceaselessly lie around his/her age. 1: Ayeza Khan 15 January 1987 2: Mehwish Hayat 6 January 1988 3: Saba Qamar 5 April 1987 4: Sajal Alay 17 January 1994       5: Sara Khan 14 July 1992 6: Iqra Aziz 24 November 1997     7: Alizeh Shah 9 June 2000 8: Zara Noor Abbas 13 March 1991 9: Saboor Aly 3 March 1995 10: Hina Altaf 2 January 1992 11: Sana Javed   25 March 1993 12: Momal Sheikh   6 April 1986 13: Hiba Bukhari 27 July 1993 14: Hira Mani 27 February 1989 15: Aiman Khan 20 November 1998 16: Minal Khan 20 November 1998 17: Kinza Hashmi 7 March 1997 18: Kubra Khan  16 June 1993 19: Mawra Hoccane 28 September 1992 20: Urwa Hoccane 2 July 1991 21: Ha...

Good Morning Wishes