Comments

Monday, March 11, 2013

Programming in C-Variable and Data types

Posted by at 5:06 PM Read our previous post
I hope all of you are able to install Codeblock .I like to use key-board short-cut keys and for creating a new file press  ctrl+shift+N

# Now write-
                        #include <stdio.h>
                                 int main ()
                             {
                                printf("Hello World");
                                return 0;

                             }

 #include<stdio.h>  -It is the header file.Every programmed has it's header file .Here .h is the extension of header.You should identify what you want to do and declare it with the header file so that the machine can get the direction of variable.  

What Exactly is a Variable Declaration ?. 

                                    #include <stdio.h>
                                     int main()
                               {
                                    int a;
                                    int b;
                                    int sum;
                                    a = 50;
                                    b = 60;
                                    sum = a + b;
                                    printf("Sum is %d", sum);
                                    return 0;
                                }

Here a, b, sum, are variable.

  In this example- int a;

           this statement is a combination of declaration of integer( int ) a and assign its value to it,so it is a definition statement.
A variable is the name for a place in the computer's memory where you store some data. A variable is a meaningful name of data storage location in computer memory. When using a variable you refer to memory address of computer.


c programming-mywebtune
                                   
                                   Data Types : When we use a variable in a program then we have to mention the type of data.

C has the following basic built-in data types:
  • int
  • float
  • double
  • char

    int - data type

    int is used to define integer numbers.
        {
            int a;
            a = 50;
        }
    

    float - data type

    float is used to define floating point numbers.
        {
            float a;
            a = 50.6;
        }
    

    double - data type

    double is used to define BIG floating point numbers. It reserves twice the storage for the number. On PCs this is likely to be 8 bytes.
        {
            double A;
            A = 2500000;
        }
    

    char - data type

    char defines characters.
        {
            char Letter;
            Letter = 'x';
        } 
    Feel any problem,then comment me.
    see you again.....



          

2 comments:

Blogger Tips And Tricks|Latest Tips For Bloggers Free Backlinks

Members

©2013 My WebTune is powered by Blogger