Sunday 3 July 2011

C language

I have learned the C language in 10 days. It is very useful language. It is useful to learn any another Computer language. C becomes a basic for writing an OS such as Windows, Unix, Linux etc. It is basically a Procedure Oriented Programming Language (POP).

       C language was found by Dennis Ritche at AT&T's bells Laboratories,USA. It is an advancement to Basic CPL... the then programming language. 
        Now in order to communicate with the computer, C language is used. C is a middle level language capable of interacting with the both hardware & software. 

How to learn C language? 
  1. First learn the Alphabets & numbers.
  2. Next, learn the Keywords.
  3. Next, learn how to write an instruction.
  4. Finally, how to write a program.
Now lets us see it in detail.
  1. C supports all Alphabets, Numbers & special symbols.
  • Keywords are the words reserved by th compiler 
  • int - to declare an integer
  • float - to declare a float i.e. decimal point numbers.
  1. Instruction follows some rules
  • Declaration type instruction declares a data type.
  • I/O instructions for input and output.
  • control instructions to take control to the specified point....etc
Now, lets see a sample program
   #include<stdio.h>    /* header file */
   void main()     /* function*/
   {
      int a,b,c;       /Declaration instruction/
            
      printf("enter the values");      /* for output */
      scanf("%d%d",&a,&b);        /* for input */
      
      c=a+b;          /*Arthematic instruction */
      printf("\n %d",c);
}