How to write First C program "hello world" ?

First C programming language program HELLO, WORLDLet us begin learning C programming language with "Hello, World" program. In this program, we print the words "hello, world" as the output.



hello world in C, print hello world in c, hello world in c program, hello world in c language, "Hello, World!" program.
The C Programming Language C hello world program


In C, the program to print ``hello, world'' is

#include <stdio.h>
main()
{
printf("hello, world\n");

}


A C program embrace of functions and variables. A function contains statements that define the computing operations to be done, and variables store values used during the computation. C functions are like the subroutines and functions in Fortran or the procedures and functions of Pascal. Our example is a function named main. Normally you are at freedom to give functions whatever names you like, but ``main'' is special - your program begins executing at the beginning of main. This means that every program must have a main somewhere.

main will usually call other functions to help perform its job, some that you wrote, and others from libraries that are provided for you. 


The first line of the program, #include <stdio.h> tells the compiler to include information about the standard input/output library; the line appears at the beginning of many C source files.

One method of communicating data between functions is for the calling function to provide a list of values, called arguments, to the function it calls. The parentheses after the function name surround the argument list. In this example, main is defined to be a function that expects no arguments, which is indicated by the empty list ( ).



The first C program

#include <stdio.h>        -  include information about standard library.
main()                           - define a function called main that received no argument values.

{                                    - statements of main are enclosed in braces.

printf("hello, world\n");     - main calls library function printf to print this sequence of characters.


}                                  - \n represents the newline character.


The statements of a function are enclosed in braces { }. The function main contains only one statement,


printf("hello, world\n");

Some other ways to print "hello, world" in C programming language are :

HELLO.C -- Hello, world


Type 1 :

#include<stdio.h>

main()
{
printf("hello, world\n");
}


return();

Type 2 : hello world, C language

#include <stdio.h>

int main() {
    puts("Hello, world!");
    return 0;

}

Type 3 : Hello World in C

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[])
{
printf("Hello, World!");
return EXIT_SUCCESS;
}


Learn More :