Hello World Program In C

Weclome to nkcoderz.com website. In this post we will learn how to write hello world program in C, So there are various ways in which we can do this task.

Hello World Program In C

Hello World Program In C

#include <stdio.h>
int main()
{
    printf("Hello World");
  return 0;
}
Output:

Hello World

Hello World Program Using Character Variables

#include <stdio.h>
int main()
{
  char s1[] = "Hello World";
  printf("%s", s1);
  return 0;
}
Output:

Hello World

Hello World Program Using Puts Function

#include <stdio.h>
int main()
{
    puts("Hello World");
  return 0;
}
Output:

Hello World

How “Hello World!” program works?

  • The #include is a preprocessor that tells the compiler to include the libraray stdio.h (standard input and output) file in the program.
  • The stdio.h file have functions like scanf() and printf() to take input and display output respectively.
  • To use the printf() function you need to #include <stdio.h>, in the program.
  • Execution of any program starts from main() function in C.
  • If we are using int main then we need to return something, that’s why we return 0 which means program executed succesfully.

That’s all from my side I hope you enjoyed this post Hello World Program In C as much as I enjoyed while writing it.


If You Like This Page Then Make Sure To Follow Us on Facebook, G News and Subscribe Our YouTube Channel. We will provide you updates daily.