C Language | Hello World a start with programming

Monday, 3 December 2012

C language is a basic programming language used to create simple to complex programs. C has different kinds of commands such as pre-processors, arrays, strings, if else statements and switch case statements. During my first lecture in this subject, programming, my professor introduce to us C language using the well known Hello World program. So, to introduce to you C language I will show you the Hello World program.

In this program, we used simple codes. We have there the pre-processor command which is the #include and the header files stdio.h and conio.h. There is also our command for output which is the printf. Lastly, to terminate the program getch(); is the key for that. It prompts user to input any character that will not show but rather to terminate the program. Check out the codes below.


   1:  #include <stdio.h>
   2:  #include <conio.h>
   3:   
   4:  int main()
   5:  {
   6:  printf("Hello World!");
   7:  getch();
   8:  }



When the program is run it will automatically show the phrase Hello World! because under the main function only printf is the present command that will be generated in the program to make an action. To terminate the program you can just simply enter any character to trigger the command. Check out the sample output below.




Hope you learned something. Feel free to leave a comment below. Thanks!

No comments:

Post a Comment

Please do leave a comment. It's gonna be a friendly conversation between programmers. Hope you do find our blog helpful. Thank you!

Related Posts Plugin for WordPress, Blogger...