“Hello World” program in C

This is just to give you a small example of a program in C programming. This is just a small traditional Hello World program. You can learn all things step by step.

# include <stdio.h>
 int main() { 
// printf() displays the string inside quotation 
printf("hello world"); 
return 0; 
}

Output

hello world

How program works in C?

  • #include includes the input output library functions and they are also known as a header file.
  • # are the indicates as a Preprocessor directive.
  • int main() The main() function are define as a entry point of every function in c language.
  • Printf() printf() functions is used to print data on the console.
  • The next line return 0, terminates the main() function and returns the value 0.

Compile and Run the C program

Here we can see how to save the code and how to compile and run it.

There are two ways to compile and run the code.

  • First By Menu
    • Open the text editor and add the code.
    • Save the file as hello.c.
    • Now click on the Compiler menu then click sub menu to compiler the c program.
    • Then click on the run menu then click sub menu to run the c program.
  • Second By Shortcuts
    • You can press the alt+f9 keys compile the program directly.
    • You can press the ctrl+f9 keys run the program directly.

Submit your review
1
2
3
4
5
Submit
     
Cancel

Create your own review

The Technical Funda
Average rating:  
 0 reviews