                      C  -  L A N G U A G E
                      ---------------------
HISTORY
-------
     In the late 1960's, a Combined Programming Language Project was
jointly undertaken by the London and Cambridge Universities. The aim
was to fuse together the bright aspects of existing languages like
ALGOL (Algorithmic Language), PL/1 (Programming Language 1), FORTRAN
(Formula Translator), etc. The outcome was BCPL (Basic Combined
Programming Language) written by Martin Richards in 1969.

     BCPL made an immediate impact on the academic circle and among
computer programmers. Ken Thompson, a programmer at the Bell
Telephone Laboratories of AT&T (American Telephone and Telegraph)
who was attempting to write a FORTRAN language compiler for the
UNIX operating system was so influenced by this BCPL, that he ended
up with a new language called B in the year 1970.

     B language was interpreter based and typeless.  Later a compiler
version of the language B was developed, called NB. But it had the
drawback of being a typeless language, Dennis M.Ritchie, to developed
the C language with a variety of data types and a compiler.


TOKENS
------
All the C Program can be functionally split into six token
1. Keyword
2. Identifier
3. Constant
4. String Literal
5. Operator                                                              
6. White Space

Example
-------
/* PROGRAM TO PRINT MESSAGE AND YEAR */ -------> White Spaces
main()
{
 int y;
  |  |------------------------------------------>Identifier or Variable
  |
  |---------------------------------------------> Keyword or Reserved Word

  y = 1999;
    |   |---------------------------------------->Constant
    |
    |-------------------------------------------->Operator

 printf("Hello World\n");
            |
            |------------------------------------->String Literal

 printf("The Year is : %d",    y);
                            |---------------------->White Spaces
                   
 }

Keyword
-------
A Keyword, otherwise known as a reserved word, is a word, which has
a predefined meaning in the language.

Example
-------
int,char,auto,double,static,do,if etc.

Variable or Identifier
----------------------
A Variable or Identifier is a name given to a memory location it
holds the values that varries during program execution.

Variable Declaration
--------------------
Syntax
------
1.  Type <Variable Name>
2.  Type V1,V2,V3... where V1,V2,V3 are variables

Example
-------
int a;
char c;
float salary;

There are three type of Variable Declaration, They are
------------------------------------------------------
1. Local Variables
-------------------
   Variables Declared inside the block or function.

2. Global Variables
-------------------
 Variable Declared outside of all the block or function.

3. Formal Parameters Or Formal Variables
----------------------------------------
Variable Declared in the Function definition.


Example
-------
void cal(int s1,int s2,int s3)
float average;                            /* GLOBAL VARIABLES */
main()
{
 int m1,m2,m3;                            /* LOCAL VARIABLES */
 printf("Enter The Marks ");
 scanf("%d %d %d",&m1,&m2,&m3);
 cal(m1,m2,m3);
 print("The Average is %6.2f\n",average);
}

void cal(int s1,int s2,int s3)           /* FORMAL PARAMETERS */
{
 int total;
 total = s1 + s2 + s3;
 average = total / 3.0;
}

Variable Initialization
-----------------------
Syntax
------
 Type Variable_name = Initial_Value;
Example
-------
int a=0;
int j=100;


Variable Attributes
-------------------
1. Type
-------
Meaning of the value associated.

2. Storage Class
----------------
How and how long data is to be stored.

Datatypes
---------
Datatypes are classified in two, they are

Basic Types
-----------
1. char
2. int
3. float
4. double 
5. void

Derived Types
-------------
1. Array
2. Function
3. Pointer
4. Structure
5. Union

Type Modifier
-------------
The basic data types can take in a type modifier preceding the
type declaration. This help in modifying the meaning of the
basic data types as per the requirements. they are

1. Signed
2. Unsigned
3. Long
4. Short

All the above modifier can be applied for Int datatype
Long Modifier can also used for double type.


Char Datatype
-------------
Type char is used to store any member of the ASCII character set.
It occupies one byte of memory.

Int Datatype
------------
Type int is used to store numbers without the fractional part.
It occupies 2 bytes of memory , integer value range from
-32768 to +32767.

Float Datatype
--------------
Type float is used to store numbers with fractional part.
It occupies four bytes of memory and gives six digit of precision.

Double Type
-----------
Type double is also used to store numbers with fractional part.
It occupies eight bytes of memory and gives ten digits of precision.
If Long Modifier is used double then it occupies ten bytes of
memory.

Void Type
---------
Type Void is used to specify an empty set of values.

-------------------------------------------------------------------
TYPE                        SIZE                           RANGE 
                         (IN BYTES)                          
-------------------------------------------------------------------
UNSIGNED CHAR                   1                       0 TO 256

CHAR                            1                    -128 TO 127

UNSIGNED SHORT                  2                  -32768 TO 32767

SHORT                           2                       0 TO 65535

INT                             2                  -32768 TO 32767

UNSIGNED INT                    2                       0 TO 65535

UNSIGNED LONG                   4                  0 TO 4294967295

LONG                            4        -2147483648 TO 2147483647

FLOAT                           4               3.4E-38 TO 3.4E+38

DOUBLE                          8             1.7E-308 TO 1.7E+308

LONG DOUBLE                    10           3.4E-4932 TO 3.4E+4932

---------------------------------------------------------------------

Storage Class
-------------
1. Auto

2. Static

3. Register

The storage class indicates to the compiler how to store a
particular variable

syntax
------
 starage_specifier type variable_name

1. Auto
-------
By Default all local variables are assumed to be auto. Local variables,
otherwise called as automatic variables, are known only to the region
of the block of the function in which they are declared. They are
created upon entry into their block and destroyed upon exit.

Example
-------
main()
{
 int mark1,mark2,mark3;
 float average;
 mark1=55;
 mark2=67;
 mark3=76;
  {
   auto int total;
   total = mark1 + mark2 + mark3;
   average = total /3;
  }
  printf ("Average = %6.2f",average);
 }


Static
------
The static variables are known only to the region of the block
of the function in which they are declared, but once created
they remain in existence throughout the execution of the program,
retain their values.

Example
-------

void fibonacci(void);
main()
{
 int i;
 for (i=0;i<5;i++)
 fibonacci();
}

void fibonacci(void)
{
 static int a=0;
 static int b=1;
 print ("%d\t%d\t",a,b);
 a=a+b;
 b=b+a;
}

Register
--------
Normally all variables are stored in the RAM of the computer.
The register specifies that the value of the variable is to
be stored directly in register of the micro-processor.
no memory is needed for this type of variable and faster access.

Example
-------

/*Print the first 50 even numbers */
main()
{
 register int i;
 for (i=0;i<=100;i+=2)
 printf("%d\t",i);
}

---------
Operators
---------

1.  Unary Operators
2.  Additive Operators
3.  Multiplicative Operators
4.  Relational Operators
5.  Equality Operators
6.  Logical Operators
7.  Assignment Operators
8.  Comma Operators
9.  Conditional Operators

1.Unary Operators
-----------------
1.  Unary Minus Operator                 -identifier
2.  Unary Plus OPerator                  +identifier
3.  Address Operator                     &identifier
4.  Logical Negation Operator            !identifier
5.  Sizeof Operator                      sizeof(identifier)
6.  Cast                                 (type)identifier
7.  Prefix Incrementation Operator       ++identifier
8.  Prefix Decrementation Operator       --identifier
9.  Postfix Incrementation Operator      identifier++
10. Postfix Decrmentation Operator       identifier--

2. Additive Operators
---------------------
The Operator used for adding and subtracting are known as
additive operators.

1. +    Addition
2. -    Subtraction

3. Multiplicative Operators
---------------------------
The Operators used for finding the product, quotient and remainder
are known as Multiplicative Operators

1. *    Multiplication
2. /    Division
3. %    To finding the Remainder

4. Relational Operators
-----------------------
Relational Operators are used to compare two values.

1. >    Greater than
2. <    Less than
3. <=   Less than or Equal to
4. >=   Greater than or Equal to

5. Equality Operators
---------------------

1. ==   Equal to
2. !=   Not Equal to

6. Logical Operators
--------------------
Logical Operators are used to combine relational expressions.

1. &&   And  
2. ||   Or
3. !    Not


7. Assignment Operators
-----------------------
Assignment Operators are used to store the value to the
variable . There are two types

(i) Simple Assignment Operator
     = (symbol)
    Example
    -------
    a=a+b
    a=a-b
    a=a*b
    a=a/b

(ii) Combined Assignment Operator
      +=,-=,*=,/=,%=
      Example
      -------
      a+=b
      a-=b
      a*=b
      a/=b

8. Comma Operator
-----------------
The Comma operator allows multiple expressions inside the a
set of paranthesis.

Example
-------
printf("%d  %d  %d ",i,j,m);

9. Conditional Operator
------------------------
The Conditional operator ?: also known as the ternary operator.

syntax
------
condition expression ? expression 1 : expression 2

if the condition expression evaluates to true, then the
expression1 executes otherwise expression2 executes.


Jump Statement
--------------
1. Break
2. Continue
3. Goto
4. Return

Break Statement
---------------

The break statement is used with loop statements to exit from
the loop and with switch statement to exit a case.

Example
-------
/* THIS PROGRAM WILL PRINT 1..50 NUMBERS */
main()
{
 int i=1;
 while (i<=100)
 {
  printf("%d",i);
  if(i==50) break;
 }
 getch();
 }


Customized Data Types
---------------------
Typedef
-------
C provides a facility for creating user defined new data type
using typedef keyword.

Syntax
------
  Typedef Type User_defined_name;

Where type_name is any valid C datatype
user_defined_name is the new name for the type.

Typedef does not create any new data type, but it defines a new
name for the existing data type.

Example
-------
(i)
main()
{
 typedef float distance;
 distance a,b;
 print("enter the value :");
 scanf("%d,%d",&a,&b);
 }

(ii)
typedef char str;
str name[20],addr[20];


Structure
---------
A structure is a collection of variables referenced by a single
name.  This provides an easy and convenient means of grouping
together of related information as a single entity.
The variables which is declared inside the structure are
called members;

Syntax
------
 struct structure_tag { variable_list};

 struct structure_tag {
                        type var_name;
                        type var_name1;
                        ..
                        ..
                      } structure_var_name_list;

 struct structure_tag {
                        type var_name;
                        type var_name1;
                        ..
                        ..
                      };
 struct structure_tag var_name;


Example
-------
1.
 struct student {
                 int rollno;
                 char name[25];
                 int mark1,mark2,mark3,total;
                 float average;
               };
 struct student sturec;

2.
 struct student {
                 int rollno;
                 char name[25];
                 int mark1,mark2,mark3,total;
                 float average;
               }sturec;


The (.) Operator
----------------
The structure member operator . (also called Dot Operator) is used
to connect the structure name and the member name. This (.) Operator
is used refer to any individual member.

Example
-------
1. sturec.rollno=123;

2. scanf("%d",&sturec.rollno);

3. printf("Roll No : %d",sturec.rollno):


Structure Assignments
---------------------
The information in one structure can be assigned to another
structure.

Example
-------
main()
{
 struct date{
              int dd;
              int mm;
              int yy;
             }a,b;
 printf("Enter the Date as [DD MM YY]");
 scanf("%d,%d,%d",&a.dd,&a.mm,&a.yy);
 b=a;
 printf("Date is :  %d-%d-%d",b.dd,b.mm,b.yy);
 getch();
 }

Structure Initialization
------------------------
Example
-------

       main()
       {
        struct marks{
                        int m1;
                        int m2;
                        int m3;
                      }a={78,66,89};
        printf("Mark : %d %d %d",a.m1,a.m2,a.m3);
        getch();
        }                      


RECURSION
---------
Recursion is the process of defining something in terms of itself.
A recursive function is a function that calls itself, directly or
indirectly.

MACROS
------
Macro returns either true or false

isalnum(c)      an alphabet or a digit

isalpha(c)      an alphabet

iscntrl(c)      a control character (ASCII value 0 to 31)

isdigit(c)      a digit (ASCII value 48 to 57)

isgraph(c)      a graphic character (ASCII value 128 to 255)

isprint(c)      a printable character including space.

ispunct(c)      a printable character excluding space,alphbets
                and digits.

isspace(c)      either a space,newline,carriage return,
                horizontal tab or vertical tab

isupper(c)      an uppercase letter (ASCII value 65 to 90)

islower(c)      a lowercase letter (ASCII value 97 to 122)

isxdigit(c)     a hexadecimal digit.

            

ARRAY
-----
 AN ARRAY IS ALLOCATED AS A CONTIGUOUS BLOCK OF MEMORY AND IS
REFERRENCED BY A COMMON NAME.

ARRAY MAY HAVE ANY NUMBER OF DIMENSIONS.  A SINGLE DIMENSION
ARRAY IS DECLARED AS

SYNTAX
------
   TYPE VAR_NAME[NO OF ELEMENTS];

EXAMPLE
-------
1. CHAR A[10];
2. INT N[20];

DOUBLE DIMENSION ARRAY
----------------------
A TWO DIMENSION ARRAY IS AN ARRAY OF SINGLE DIMENSION ARRAYS. IT IS
DECLARED AS

SYNTAX
------
 TYPE VAR_NAME[NO OF ELEMENTS][NO OF ELEMENTS];
EXAMPLE
-------
1. CHAR S[10][10];
2. INT N[3][3];


ARRAY WITHIN STRUCTURES
-----------------------
THE MEMBER OF A STRUCTURE NEED NOT BE ONLY SIMPLE DATA TYPE. THEY
MAY ALSO BE DERIVED DATA TYPES LIKE ARRAYS.

EXAMPLE
-------
STRUCT STUDENT{
                INT ROLLNO;
                CHAR NAME[20];
                INT MARK[3],TOTAL;
                FLOAT AVERAGE;
                }STUREC;
 
ARRAY OF STRUCTURES
-------------------
TO DECLARE AN ARRAY OF STRUCTURES, THE STRUCTURE IS FIRST DEFINED
AND THEN AN ARRAY VARIABLE OF THAT TYPE IS DECLARED

EXAMPLE
-------
[1] STRUCT STUDENT{
                    INT ROLLNO;
                    CHAR NAME[20];
                    INT MARK1,MARK2,MARK3,TOTAL;
                    FLOAT AVERAGE;
                    } STUREC[20];


[2] STRUCT STUDENT{
                    INT ROLLNO;
                    CHAR NAME[20];
                    INT MARK1,MARK2,MARK3,TOTAL;
                    FLOAT AVERAGE;
                   };
    STRUCT STUDENT STUREC[20];

 ASSIGNNING VALUE TO THE ARRAY OF STRUCTURE
 -------------------------------------------
    STUREC[1].ROLLNO=111;
    STUREC[2].MARK1=78;

STRUCTURES WITHIN STRUCTURES
----------------------------
A STRUCTURE CAN BE A MEMBER OF ANOTHER STRUCTURE. THIS IS CALLED AS
A NESTED STRUCTURE.

EXAMPLE
--------
1. STRUCT DATE {
                 INT DD,MM,YY;
                };

2. STRUCT EMPLOYEE {
                 INT EMPNO;
                 CHAR ENAME[20];
                 STRUCT DATE DOB;
                 CHAR DISIG[20];
                 FLOAT SALARY;
                 } EMP;

 THE MEMBER INSIDE EMP AND DATE STRUCTURE CAN BE ACCESSED IN
 FOLLOWING WAYS.
 ------------------------------------------------------------
 1. EMP.EMPNO=1001;
 2. EMP.ENAME="JOHN";
 3. EMP.DOB.DD=20;
 4. EMP.DOB.MM=10;
 5. EMP.DOB.YY=1999;
 6. EMP.DISIG="ASST. MANAGER";
 7. EMP.SALARY=10000.00;

TYPEDEF STRUCT
--------------
THE TYPEDEF CAN BE USED TO DEFINE A STRUCTURE TEMPLATE.

TYPEDEF STRUCT {
                 INT ROLLNO;
                 CHAR NAME[20];
                 INT MARK1,MARK2,MARK3,TOTAL;
                 FLOAT AVERAGE;
                 }STUDENT;

 HERE STUDENT IS THE NAME OF THE STRUCTURE DEFINED WITH TYPEDEF
 AND A STRUCTURE VARIABLE.

DECLARING A STRUCTURE VARIABLE
------------------------------
STUDENT STUREC;

U N I O N
---------
UNION IS A MEMORY LOCATION THAT IS SHARED BY TWO OR MORE VARIABLES
OF DIFFERENT TYPE AT DIFFERENT TIMES. THEY PROVIDE THE POWER OF
MANIPULATING DIFFERENT KINDS OF DATA IN A SINGLE AREA IN MEMORY.

SYNTAX
------
 UNION UNION_TAG {
                   TYPE VAR_NAME;
                   TYPE VAR_NAME1;
                   ..
                   ..
                   ..

                  } UNION_VAR_NAME_LIST;

EXAMPLE
-------

UNION DATE {
              INT DD,MM,YY,HH,MI,SS;
            } MDATE;


P O I N T E R S
---------------
A POINTER IS A VARIABLE THAT IS MEANT FOR HOLDING THE ADDRESS OF
ANOTHER VARIABLE IN MEMORY.

ADVANTAGES OF USING POINTER
---------------------------
1. POINTERS CAN BE MADE TO POINT TO DIFFERENT DATA AND DIFFERENT
   DATA STRUCTURES.  BY CHANGING THE CONTENTS OF THE POINTER, DATA
   CAN BE MANIPULATED AT DIFFERENT LOCATIONS.

2. MEMORY CAN BE ALLOCATED DURING PROGRAM EXECUTION USING POINTERS.
   THIS IS KNOWN AS DYNAMIC MEMORY ALLOCATION.

3. POINTERS CAN BE USED TO ACCESS DIFFERENT LOCATION WITHIN
   A DATA STRUCTURE, SUCH AS AN ARRAY OR A STRUCTURE.

4. POINTERS PROVIDE THE ONLY WAY BY WHICH FUNCTION PARAMETERS
   CAN BE PASSED BY REFERENCE.

5. POINTERS ENHANCE THE OVERALL EFFICIENCY OF CERTAIN ROUTINES,
   THEREBY INCREASING THE EXECUTION SPEED OF PROGRAMS.

POINTER VARIABLE DECLARATION
----------------------------
SYNTAX
------
   TYPE *VAR_NAME

HERE * IS CALLED INDIRECTION OPERATOR.
TYPE CAN BE ANY C DATA TYPES.

POINTER OPERATORS
-----------------
THERE ARE TWO SPECIAL UNARY OPERATORS USED WITH POINTERS
1. &    ADDRESS OPERATOR

2. *    INDIRECTION OPERATOR.


BUILT-IN FUNCTIONS
------------------
STRING FUNCTIONS
----------------
STRING IS DEFINED AS AN ARRAY OF CHARACTERS TERMINATED WITH A
NULL CHARACTER. THESE FUNCTIONS PROTOTYPE ARE DECLARED IN THE
STRING.H HEADER FILE

1. STRCPY()
-----------
TO COPY STRING FROM SOURCE TO TARGET.

EXAMPLE
-------
main()
{
 char s[100];
 strcpy(s,"C is a Programming Language");
 puts(s);
}

2. STRCAT()
-----------
TO CONCATENATE STRINGS

THE FUNCTION STRCAT() CONCATENATES THE STRING SOURCE TO THE STRING
DESTINATION.

EXAMPLE
-------
#include<string.h>
main()
{
 char s[10]="MICRO";
 strcat(s,"WAVES");
 puts(s);
 }

3. STRCMP()
-----------
TO COMPARE TWO STRINGS.

eg. strcmp(string1,string2);

THE FUNCTION STRCMP() COMPARES THE STRING STRING1 AND STRING2 AND
RETURNS A VALUE

   < 0   IF STRING1 IS LESS THAN STRING2
     0   IF STRING1 IS EQUAL TO STRING2
   > 0   IF STRING1 IS GREATER THAN STRING2

4. STRLEN()
-----------
TO FIND THE LENGTH OF A STRING.

EXAMPLE
=======
main()
{
 printf("%d",strlen("COMPUTER"));
 }

5. STRCHR()
-----------
SEARCH FOR A CHARACTER IN A STRING.

EXAMPLE
--------
main()
{
 char s[100],c;
 gets(s);
 c=getchar();
 if(strchr(s,c)) printf("Found");
 else printf("not found");
 }

6. STRSTR()
-----------
TO SEARCH FOR A STRING WITHIN ANOTHER STRING.


MATHEMATICAL FUNCTIONS
-----------------------
1. SIN(X)       SINE OF X

2. COS(X)       COSINE OF X

3, TAN(X)       TANGENT OF X

4. ASIN(X)      ARC SINE OF X

5. ACOS(X)      ARC COSINE OF X

6. ATAN(X)      ARC TANGENT OF X

7. SINH(X)      HYPERBOLIC SINE OF X

8. COSH(X)      HYPERBOLIC COSINE OF X

9. TANH(X)      HYPERBOLIC TANGENT OF X

10. EXP(X)      NATURAL LOGARITHM E RAISED TO POWER X

11. LOG(X)      NATURAL LOGARITHM OF X

12. LOG10(X)    BASE 10 LOGARITHM OF X

13. POW(X,Y)    X RAISED TO THE POWER Y

14. SQRT(X)     SQUARE ROOT OF X

15. FABS(X)     ABSOLUTE VALUE OF X

16. FMOD(X)     REMAINDER OF X/Y.

17. ABS(N)      ABSOLUTE VALUE OF INT N

18. LABS(N)     ABSOLUTE VALUE OF LONG N


CALLING FUNCTIONS           
=================
1. CALL BY VALUE
2. CALL BY REFERENCE

CALL BY VALUE
-------------
COPY OF THE ACTUAL PARAMETER WILL BY PASSED TO THE FORMAL
PARAMETER.  HERE ACTUAL VALUE WILL NOT BE AFFECTED WHEN THE FORMAL
VALUE IS CHANGED OR ALTERED.

CALL BY REFERENCE
-----------------
ADDRESS OF THE ACTUAL PARAMETER WILL BE PASSED TO THE FORMAL
PARAMETERS. HERE ACTUAL VALUE WILL BE ALTERED WHEN THE FORMAL
PARAMETER IS CHANGED OR ALTERED.

EXAMPLES ARE GIVEN IN CBVAL.C AND CBREF.C


Pre-Processor Directives
========================

A preprocessor as the name suggests, is the first step in compilation.
C provides a means of including compiler specific instructions in the
source code.  These instructions are called as preprocessor directives.
They are generally used to perform

 1. inclusion of named files (Header Files)
 2. macro substitution
 3. condition compilation.

Advantage Of Macros
-------------------
1. Macros increase the execution speed of the program.
2. The arguments and the returned value in a macro may be of any type.

The preprocessor directives defined by the ANSI standard are
------------------------------------------------------------
  #include
  #define
  #if
  #endif
  #else
  #elif
  #ifdef
  #ifndef
  #undef
  
Syntax
------
1. #include<header file>
     - It instruct the preprocessor to include named source file.

2. #define identifier_name replacement_text
     - It defines an identifier and a replacement text. This is called
       macro substistution.

3. #if <expression>
     statements;
   #endif

4. #if <expression>
    statements;
   #else
    statements;
   #endif;

5. #if <expression>
     statements;
   #elif <expression>
     statements;
   #elif <expression>
     statements;
   #endif


Files
-----
 File is basically used to store data permenatly.
In C language files are otherwise called stream. There are two
types of streams

1. Text Stream
2. Binary Stream.

Text Stream
-----------
A text stream is a sequence of ASCII charaters organized into lines,
each line terminated by a newline character. The newline character
is tranlated into two characters , a carriage return and a line feed.
This result in a difference between the number of character found
in the stream and the number actually present in the file.

Binary Stream
-------------
A binary stream is a sequence of bytes with a one-to-one correspondence
to those in the file.  No character Conversion take place, hence the
number of characters found in the stream tally with the number of
character in the file.

File Pointer
------------
A stream is associated with a specific file by performing an open
operation.  Once the file is opened, information may be exchanged
between the file and the program.  The library function fopen()
is used for this purpose.

Defined Type
------------
FILE      -    typedefined structure to hold various information
                like filename,status,current position of the file
                pointer etc.

Declaring a File variable
-------------------------
FILE *fp;

fopen()
-------
 To open a stream

syntax
------
fp= fopen("filename",mode);

-----------------------------------------------------------------------
 Mode                    Meaning
-----------------------------------------------------------------------
 r                      Open a file for reading only

 w                      Create a file for writing

 a                      Open a file for appending if the file
                        exists, otherwise create the file
                        for writing.

 r+                     Open a file for read/write.

 w+                     Create a file for read/write.

 a+                     Append/create a file for read/write

--------------------------------------------------------------------------

Note : By default all the file accessed in textstream.

If you want to be specific with the mode.

 t (text)
 b (binary)

 rt,wt,at,rb,wb,ab,r+t,w+t,a+t,r+b,w+b,a+b


fclose()
--------
 To close the stream.

syntax
------
 int fclose(file_pointer);

  0 - successfull.

 EOF - otherwise.

example
-------
 FILE *fp;
 fp=fopen("sample.dat",w+);
 fclose(fp);






 






