Hello world Program in C


C Programming Language

Hello world Program in C :-

How to write a hello world program in C language?  
To learn a programming language, you must start writing programs in it, and this could be your first C Hello world program. Let's have a look at the program first.
Program : -

1
2
3
4
5
6
#include<stdio.h>
int main()
{
 printf("hello world \n");
 return 0;
}
Output :-
root@batman:~/Desktop/CPrograms# gcc helloworld.c 
root@batman:~/Desktop/CPrograms# ./a.out
hello world 

Explanation :-
 
#include<stdio.h>
in c programming language is a statement which tells the compiler to insert the contents of stdio at that particular place. stdio.h is the header file for standard input and output. This is useful for getting the input from the user(Keyboard) and output result text to the monitor(screen)

int main() 
in c programming language main() is a program's execution entry point of C, C++ or some other programming languages. It is system declared (pre declared) function which is defined by the programmer.
main() is a function, which is invoked (called) through operating system when program's execution is going to start.

printf();
In c programming language, printf() function is used to print the “character, string, float, integer, octal and hexadecimal values” onto the output screen. We use printf() function with %d format specifier to display the value of an integer variable or you can say that call the value. 

\n
in c programming language To generate a newline,we use “\n” in C printf() statement.

return 0; 
 in c programming language It is not necessary that every time you should use return 0 to return program's execution status from the main() function. But returned value indicates program's success or failure to the operating system and there is only one value that is 0 which can indicate success and other non zero values can indicate failure of execution due to many reasons.

Screen Shot Of Program:-

Program : -
hello world program in c

Output :-

output of hello world program


Next Post
1 Comments
  • Knife Hubs
    Knife Hubs Tuesday, June 22, 2021

    Monitor Bee
    Monitor Bee
    Monitor Bee
    Monitor Bee
    Monitor Bee
    Monitor Bee
    Monitor Bee
    Monitor Bee
    Monitor Bee
    Monitor Bee

Add Comment
comment url