• Home
  • Game
  • C++
  • Java
  • Android
  • No Need
  • Variables And Data Types In C++


    Name
    Size*
    Range*
    Example
    Char
    1 byte
    Signed: -128 to 127
    unsigned: 0 to 255
    ‘a’,’b’,’c’
    Int
    4 byte
    Signed: -2147483648 to 2147483647
    unsigned: 0 to 4294967295
    123,456,73,1.
    Bool
    1byte
    True or false
    True,false
    Float
    4bytes
    +/- 3.4e +/- 38 (~7 digits)
    132.23,2.5,7
    Double
    8bytes
    +/- 1.7e +/- 308 (~15 digits)
    1647464364,567

    Char
    Char type of variable are use to assign or store a character which is enclose by 2 single quotes
    char ch='k';   //ch contain 1 character  
    Char b[]=”programming is fun.”; 
    P
    R
    O
    G
    R
    A
    M
    M
    I
    N
    G

    I
    S

    F
    U
    N
    .
    /0

    In the sentence of “programming is fun.” Has 19 character include space. If we store this sentence in a char type array , we need to declare an array with 20 element.

    Int
    Int is use to define numeric variable holding whole number. The size of number that can be stored within -2,147,483,648 to 2,147,483,647 in 32 bit.
    Bool
    A Boolean constant is used to check the state of a variable, an expression, or a function, as true or false. To declare such a value, you use the bool keyword. The variable can then be initialized with the starting value. 
    Float
    Float is used to define numbers with fractional parts. It can represent the values of ranging from approximately 1.5 × 10−45 to 3.4 × 1038 with a precision of 7 digits

    Double
    A double is a larger float type that holds both bigger and more precise numbers.
    Double variables are 8 bytes in size. The range of values is from 2.2250738585072020×10−308 to 1.7976931348623157×10308
    More importantly, the precision of a double is 15 compared to 6 for a float. The precision of a number is how many digits (before and after the decimal point) it can store without errors occurring.







    Share this article :
     

    Post a Comment

     
    Support : Prosanta Chaki |
    Copyright © 2011. Funny Programmer - All Rights Reserved
    Proudly powered by Blogger