1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

what are the different format of float in c Language?

Discussion in 'Programming' started by rajuljain, Jun 22, 2012.

  1. #1
    i want know the different format or how many types of float are used in C language?
    please explain with example....
    Thanks
     
    rajuljain, Jun 22, 2012 IP
  2. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #2
    float
    double
    long double

    here is small program for you
    #include <stdio.h>
    
    int main()
    {
        float f;
        double d;
        long double ld;
    
        printf (
            "float       : %4d bytes\n"
            "double      : %4d bytes\n"
            "long double : %4d bytes\n"
            ,
            sizeof(float),
            sizeof(double),
            sizeof(long double)
        );    
        return 0;
    }
    Code (markup):
     
    Last edited: Jun 25, 2012
    Vooler, Jun 25, 2012 IP
  3. maxking1234

    maxking1234 Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Am I right in saying that a double must have a decimal point where as a float is floating point so doesn't?
     
    maxking1234, Jun 25, 2012 IP