Flipkart

Tuesday, 19 August 2014

C Programming

Points to remember While writing a C program

v  Every program requires main () function.


v  The execution of each function in a C program begins at the opening brace and ends are the corresponding closing curly brace.

                     Example

§     void main ()
§  {
§  Program statements;
§  }

v  C programs are written in lowercase.  Upper cases are used in defining Symbolic constants and output strings.

   Example

§  Const int PI = 3.14;
§  Printf(“  Hello Welcome To C Program”);

v  Statements must end in semicolon after main function

   Example

§  main()
§  {
§  Stament 1;
§  Statement 2;
§  }

v  Variables must be Declared for their types before it uses in program.

    Example

§  int age,
§  char name[12];

v  # include preprocessor must used to include header files for special functions.

     Example

§  #include<string.h>         // for the use of String manipulation
§  #include<math.h>          // for the use of formulas
§  These are the special functions strcmp(), Pow() Etc…

v  Braces are balanced when it uses to group multiple statements.

     Example

§  For (i=1;i<=4;i++)
§  {
§  For(j=1;j<=4;j++)
§  {
§  Printf(“hai\t”);
§  }
§  Printf(“\n”);
§  }


No comments:

Post a Comment