Friday, July 16, 2010

#C 1

Lets start with a simple program in C....

      #include &lsaquo stdio.h &rsaquo
      #include &lsaquo conio.h ›
        void main()
         {
            clrscr();
            printf("welcome to my blog");
         }

now lets discuss few important terms that we have used in the above program.



#   :-

  # is a symbol which tells to preprocessor that before compiling any source code written on IDE, include the header file written after syntax #include.



Header Files   :-

  Any file in C or C++ which ends with a extension .h is known as a Header file. These files are created by the company which develops the software of C language.These files contain a huge collection of predefine programs known as Functions for example-All the functions are related to mathmatical calculations like sqrt(),sin(),cos(),pow() etc available in a header file called math.h


So if programmer needs to use a predefine function which resides in a header file then he must include this header file.


Syntax   :-

  # include &lsaquo headerfile.h &rsaquo



Void   :-

  Void is a keyword and it is return type of function main().Don't bother about return type and function words i have used.We will discuss these words in detail later.key words are pre reserved words used by C compiler and they can not be used in a source code like name of variables and functions.




main()   :-

  main() is a function.At the time of compilation of programme, compiler reads the source code from very first line but CPU reads after function main().




{   :-

  This is known as "block opening bracket".when we use this it creates a stack which is very useful to put function calls in a particular order.



clrscr()   :-

  It is a function which resides in a header file &lsaquo conio.h &rsaquo


printf   :-

  This function is stands for print formatted.Here we are using this for writing message on console.This also have various other uses which we will discuss later.

}   :-

  This is known as "bock closing bracket".


;     :-

  This is used in a C programme as a "statement terminator".

No comments:

Post a Comment