Statements

Statements

The instruction, which is understandable to our compiler or interpreter, is called Statements. 

There are
1.                Executable Statement
The statement which is terminated with semicolon ( ; ) is called Executable Statement

2.                Label Statement
The statement which terminated with Colon ( : ) is called Label Statement

3.                Comment Statement
These statements are used to give the details of some statements (i.e.) The Comment statements are non-executable statements
          
 Syn

               /*      COMMENTS              */

The comment statements should be enclosed with /* and */ only.

4.                Blocked Statement
The Statement which is with in { and } Curly braces.

5.                Control Statement
The Statements which is used to control the execution of particular statement.

6.                NULL Statement
The statement which is simply terminated with semicolon ( ; ) is called NULL Statements.


Input statements
1.                 getch()
Used to get any character value form stdin without echo.
Syn:
            Character-Var = getch ();
2.                 getche()
Used to get any character value from stdin (Standard Input Device) with echo.
Syn:
            Character-Var = getche ();
3.                 gets()
Used to get any string value with spaces also from stdin.
Syn:
            Gets(String-Var);
4.                 scanf()
Used to get any basic type of values from stdin as a formatted form.
Syn:
            Scanf("Control-String", Address of Variable list);
5.                 fread()
Used to read a specified amount memory contents from the specified file pointer (Stream).
Syn:
fread(Address, Size, No.of Records, file-Pointer);
6.                 getc()
Used to read a single character from specified file pointer (Stream).
Syn:
            Getc(File-Pointer);
7.                 fscanf()
Used to get the values from specified stream (File-Pointer) as a formatted form.
Syn:
fscanf(File-Pointer, "Control-String", Address of Variable List);

Output Statements
1.                 putch()
Used to write the given Character value to stdout (Standard Output Device)
Syn:
            Putch(Character-Var);
2.                 putc()
Used to write a given Character into the specified file pointer.
Syn:
            Putc(File-Pointer);
3.                 puts()
Used to write the given string into a stdout.
Syn:
            Puts(String or String-Var);
4.                 printf()
Used to write the given values as a formatted form in stdout.
Syn:
            Printf("Control-String or String" , Variable-Lise);
5.                 fprintf()
Used to write the given values as a formatted form in specified stream (File).
Syn:
Fprinf(File-Pointer,"Control-String", Variable-List);
6.                 fwrite()
Used to write a specified memory contents as a binary format in a specified stream
(File-Pointer).
Syn:
Fwrite(Address, Size, No.of Records, File-Pointer);

Structure of ‘C’ Program :

1.                   Documentation Structure.
2.                   Header File Including.
3.                   Global Variable Declaration / Global Function Definition / any other
4.                   main() Fun. Definition (Must Present each and every ‘C’ Program)
5.                   Any other User-Defined Function Definition.

Ex:                 /*         My First ‘C’ Program           */

# include <stdio.h>             >            Header File Including
int a;                                    >            Global Declaration
main()                                  >            Main function definition
{
            int b;                         >        Local Variable Declaration
            Normal Executable and all statements
}
disp()                                    >        Used Function Definition
{
            Statements;
            }

C- Language Program Hints:
1.                  The 'C' Language is Case sensitive Language (In here the all are treated as based on that coresponding ASCII value). (American Standared Coded for Information Interchange)
2.                  Each and every 'C' Language Program's Statement should be Terminate with semicolon ( ; )
3.                  Each and every 'C' Program should contain one function. (main())
4.                  The main() function's Statements should be blocked with curly braces ( { } )
5.                  The Local Variable’s Declarations of all variables should be in the starting of the program's statements.
6.                  In 'C' program what ever we are using (Variables and all…), must be declared before using it. Declaration means nothing but, Specifying the specification about its.
7.                  In each and every program should contain the corresponding header file definition in beginning of the program in our main() function used built-in functions.
8.                  The 'C' Language is structured programming langeage. So we should follow that built-in structure.
9.                  We can  Continue the Current line with Next line with the  help of Back Slash(\)
10.                Inclusion of header files before program, is optional. But it is a good programming practice.


C- Language’s Most Wanted Header Files:

Header files are the library files having the definitions for the pre defined functions. Whenever we call a built in function, then we have to include the corresponding header file.

Syn:
# include <Header-Name.h>
Ex:
# include <stdio.h>             >        stdio.h file's definition included with  current program
stdin             >                                       Standard Input device
stdout           >                                      Standard Output device
conio.h         >                                      Consol input output  functions
ctype.h         >                                      Character Oriented functions
math.h         >                                       Mathmetical Oriented Functions.
           string.h       >                                       String Oriented Function.
stdlib.h        >                                       Standard Library functions.