Getting Started with C

The C program is a set of functions.  A C program always starts executing in a specialfunction called  main function. Here is the simple but famous "Hello World" program which prints "Hello World" greeting to screen.
1.#include <stdio.h>
2.main()
3.{
4.printf("Hello World!\n");
5.return 0;
6.}
  • The first line is the the #include directive. C program uses this directive to load external function library - stdio is c library which provides standard input/output.printf is a function which is declared in the header file called stdio.h
  • The next is the main function - the first entry point of all C programs. C program logic starts from the beginning of main function to the its ending.
  • And finally is the printf  function which accepts a string parameter. The printf function is used to print out the message to the screen.
You've learnt how to write the first program in C. Let's go to the next tutorial to explore the power of C programming language. Happy Programming!

source:cprogramlanguage.net

No comments:

Post a Comment