Wednesday, 21 August 2013

Hello world in C language

1 ) Hello world in C language

Purpose of Hello world program may be to say hello to people or the users of your software or application.
#include <stdio.h>

int main()
{
  printf("Hello world\n");
  return 0;
}
Output of Program:
Hello world

 

2) 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;
}
Output of Program:
Hello world

3) Printing hello world indefinitely

#include <stdio.h>
#define TRUE 1
 
int main()
{
  while (TRUE)
  {
    printf("Hello World\n");
  }
 
  return 0;
}

No comments:

Post a Comment