Hello world C | First Program example with printf

You have a very curious to how to Make first “Hello world C” program. It’s very easy to it print a sentence in the console or display. If you any prior experience in programming in another programming language then its very easy. If you are just starting your programming career today then this tutorial will help you lot. Let’s start tutorial on How to do First Hello world Program in C Language.

Hello world C First Program example with printf

Don’t be in Hurry 

As this is your first program so we suggest don’t try to fast because it’s not the same write first program in Java and Python.

Follow this step in the first program in c.

  1. Write a program ( we assume you already an install IDE for C)
  2. Compile – After Writing “Hello world program in c”, You have to Compile program.
  3. Run – Last step you have to Run the program, the output will show in console display.

Note – if you are using an IDE for the program then you can use a “Compile & Run“.

 

Hello world c example

Now coming to Our first Hello world c program. you need to include a <studo.h>, it contains standard input/output functions like printf. Without including this file we can use a printf function and not able to read and write input from console display.

Look at below example and follow the steps to run program.

Output: Hello World C Language is here!

 

How a Hello World program in C works?

Here is how simple C program work and its important terms.

  • include<studo.h> – Tell to compile include this file for (standard input and output) file in the program.
  • main() function – The program will start from the main function.
  • printf() function – It will send the standard output to console. You can see the output “Hello World C …etc”.
  • return 0 – Last statement in the program, will end up the program.

Note: if you are using a printf() without including a studo.h then program will now compile and show error.

error: [Error] ‘printf’ was not declared in this scope

 

Question: How to “print hello world” in c without using printf?

Answer: Is it possible to print a message in console or display without using a printf function in c?

Yes possible with different many ways for an example using put, while loop etc. See below example print “print hello world” in c without using printf program.

With While loop

 

Question: Is possible a C Program to print hello without a semicolon “;”?

Answer: Yes you can print a “Hello” or other any sentence in c without using a semicolon. Some ways are using if, switch and loop etc.

See one example for it.

Sidenote: As you see the first Hello world program in c with different approaches. There is always recommend the use printf() function and semicolon for print statement and messages in console or display. Using another way like if, while loop, not required. Its make your app is critical and long.

 

Note: This example (Project) is developed in Dev-C++ and Version 5.11

Download link for IDE – Dev-C++


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.