The printf format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I code the following code.
--------------------------
#include <stdio.h>
int main(int argc,char **argv)
{
    float f[2]={4.0, 37.4};
    printf("%.2f    %.2f\n",f[0],f[1]);
    printf("%d    %.2f\n",f[0],f[1]);
}

And it output is following.
-------------------------
4.00    37.40
-1    4.00

I confuse that f[1] is 4.00 at the second line.
Any help will be appreciated.

--GHui


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux