Delicious Digg Facebook Favorites More Stumbleupon Twitter

Friday, 24 August 2012

Operators Explanation



                     Operators Explanation

*Arithmetic operators :-  +, -, *, /, %

*Relational operators :-  <, >, <=, >=, !=

*Logical operators :-  <<, >>, &&, ||, ==

*Bit wise operators :-  &, |, ~, ^

*Conditional operators :-  ?, :

*Assignment operators :-  =

*Increment and Decrement operators :-  ++,--

*Comma operator :- ,

Operators of 'C' programming language


         Operators of C Programming language

          Operation is a combination of operands and operators.
        
          Operators are divided into 8 types.

          *Arithmetic operators.
     
          *Relational operators.

          *Logical operators.

          *Bit wise operators.

          *Conditional operators.

          *Assignment operators.

          *Increment and Decrement operators.

          *Comma operator.

      
 

Tuesday, 21 August 2012

addition of 2 variables by using dynamic values



    Addition of 2 variables by using dynamic values


           Dynamic values can be changed at run time also.
         
           #include<stdio.h>
            main()
           {
               int a,b;
               clrscr();
               printf("enter the values of a,b:");
               scanf("%d%d",&a,&b);
               c = a+b;
               printf(" c=%d",c);
               getch();
           }

         output:-
                      c=30   

addition of 2 variables by using static values


                        Addition of 2 variables

           
           Static values are constant.we can't change
           the values at run time.
         
           #include<stdio.h>
            main()
           {
               int a,b,c;
               a = 10;
               b = 20;
               clrscr();
               c = a+b;
               printf(" c=%d",c);
               getch();
           }

         output:-
                      c=30   

Simple 'c' program


                          Simple "C-Program"

         #include<stdio.h>         //Header file
               main()                           //function
            {
            
                 clrscr();                  //clear screener
                 printf("welcome");    //print the message
                         getch();                    //get a char
           }


        out put:-
                        welcome


how to write "c" program


                         Syntax for 'C-Program'

                 * Program starts with Header files.

                       * Write main function.

                       * Open {

                       * Write statements.

                       * Every statement should ends with semicolon(;).

                       * Close }

                      printf // print the message .

                     * scanf // read the input

Headerfiles


                         HEADER FILES

                 Data  ------>  Collection of information.

                 File   ------>   Collection of data.

                 Header file  ------>  Collection of files.

                 Record  ------>  Collection of header files.

                 Package  ------>  Collection of records.

                 Library  ------>  Collection of packages.

                 Header files are divided into 2 types. 

                 * Pre-defined header files.
                 * User-defined header files.

                 > Pre-defined header files :- These are Pre-defined
                 and  doesnt need to be intialised while writing
                 a program.
                  Examples for Pre-defined Header files are,

                  <stdio.h>
                  <conio.h>
                  <math.h>
                 <strings.h>
                   etc.............
                 <stdio.h> and <conio.h> these both header files are
                 default input and output header files.
                 <stdio.h> // standard input and output header file.
                 <conio.h> // console input and output header file.

                 > User-defined header files :- These header files are

                    initialized based on the requirement. Programmer
                    has to plan all the inputs and outputs of the application.