Algorithm


  1. Print Hello World.
  2. Use the printf() function to print any string.
  3. Add New Line After String to Avoid Presentational Error in some online programming judge.
  4. return

Code Examples

#1 Basic Hello World Code

Code - C Programming

#include <stdio.h>
int main() {
  printf("Hello World");
}
Copy The Code & Try With Live Editor

Output

x
+
cmd
Hello World

#2 Complete Hello World Example

Code - C Programming

#include <stdio.h>
int main() {
  printf("Hello World\n");
  return 0;
}
Copy The Code & Try With Live Editor

Output

x
+
cmd
Hello World
Advertisements

Demonstration


Why This Hello World

Hello World is the First Program of any programming language how a developer start his programming life. It means - Say the world, Hello and expressing them that - you're coming...

That's Hello World. It's also my first coding.

 

Demonstration Code Line By Line

We'll demonstrate this code line by line -

 

 First Line, 

#include<stdio.h>

We've include/import the standard header library of C programming. It's necessary to print and read. That means to print, we need to use printf() function, which function is declared in this header library file. That's why we need to import this stdio.h.

 

Next,

int main(){
   // 
}

In C programming, C program execute first on entring it's main() function. Whatever, written inside this main function, it'll be execute this.

 

Next, printf() function, as we've told that we've imported stdio.h header file for this.

printf("Hello World");

Inside printf() function, we've to pass any string. We've passed Hello World there. We could print also variables using this.

 

Next, return

return 0;

 

When C progrm finds this return 0, it executed and code will be finished processing. It's not only for C programming, it's for almost every programming language.

 

Buy C Programming Books

Next
Appending into a File in C Programming