浮点数包括有符号和无符号的小数和小数。

有符号包括正数和负数。
无符号数字只能包含正值。

浮点数的示例如下表所示。

09.1234 
3428.12 
112.12345 
-342.66 
-12345.12345

使用关键字float来声明浮点数。以下代码声明了三个名为:operand1operand2result的浮点变量数据类型。

#include <stdio.h> 
int main(){ /*from w  w  w . ja  v  a 2s .  c om*/
    float operand1; 

    float operand2; 

    float result; 

    printf("three float numbers declared.\n"); 
    float f1 = 1.25;
    float f2 = 250;
    printf("f1=f%, f2=%f2 \n", f1, f2); 
}