Sponser Site

Tuesday 23 December 2014

C hello world program

c programming language code to print hello world


#include <stdio.h>

int main()
{
  printf("Hello world\n");
  return 0;
}


Hello world program in c

We may store "hello world" in a character array as a string constant and then print it.


#include <stdio.h>

int main()
{
  char string[] = "Hello World";

  printf("%s\n", string);

  return 0;
}



Using loop we can print "Hello World" a desired number of time or indefinitely.

#include <stdio.h>
#define TRUE 1

int main()
{
  while (TRUE)
  {
    printf("Hello World\n");
  }

  return 0;
}

No comments:

Post a Comment