user-0 提问: 求助 c语言 好像是数据溢出

回复:
user: user-1
content: 12 L 正解

user: user-2
content: 这个都是最好都按照格式来写, 因为他们在内存中所占字节不同, 所以他们在读取或者输出的时候会按照%后面的格式输出

user: user-3
content: #include<stdio.h>  void main()  {  double f,g; scanf("%f,%f,",&f,&g);    printf("f=%.6f,g=%.12f\n",f,g);  }   scanf("%f,%f,",&f,&g);   其实需要的是变量的地址值 也许你这样没有加&值，这时候你知道值写到哪儿了吗？ 写到了地址值为f的地址中，然而f的值还是未知呢 这个是我的理解 csdn中： If format is a NULL pointer, the invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue, these functions return EOF and set errno to EINVAL. The scanf function reads data from the standard input stream stdin and writes the data into the location given by argument. Each argument must be a pointer to a variable of a type that corresponds to a type specifier in format. If copying takes place between strings that overlap, the behavior is undefined.

user: user-4
content: printf 输出的话，"%f" 格式可以输出float和double scanf输入的话，"%f" 格式输入float, "%lf" 格式输入double,   printf   * An optional h specifying that a following d , i , o , u , x , or X    conversion specifier applies to a short int or unsigned short int    argument (the argument will have been promoted according to the    integral promotions, and its value shall be converted to short int or    unsigned short int before printing); an optional h specifying that a    following n conversion specifier applies to a pointer to a short int    argument; an optional l (ell) specifying that a following d , i , o ,    u , x , or X conversion specifier applies to a long int or unsigned    long int argument; an optional l specifying that a following n    conversion specifier applies to a pointer to a long int argument; or    an optional L specifying that a following e , E , f , g , or G    conversion specifier applies to a long double argument.  If an h , l ,    or L appears with any other conversion specifier, the behavior is    undefined.  f  The double argument is converted to decimal notation in the style    [-]ddd.ddd , where the number of digits after the decimal-point    character is equal to the precision specification.  If the precision    is missing, it is taken as 6; if the precision is explicitly zero, no  scanf  * An optional h , l (ell) or L indicating the size of the receiving    object.  The conversion specifiers d , i , and n shall be preceded by    h if the corresponding argument is a pointer to short int rather than    a pointer to int , or by l if it is a pointer to long int .    Similarly, the conversion specifiers o , u , and x shall be preceded    by h if the corresponding argument is a pointer to unsigned short int    rather than a pointer to unsigned int , or by l if it is a pointer to    unsigned long int .  Finally, the conversion specifiers e , f , and g    shall be preceded by l if the corresponding argument is a pointer to    double rather than a pointer to float , or by L if it is a pointer to    long double .  If an h , l , or L appears with any other conversion    specifier, the behavior is undefined.  e,f,g Matches an optionally signed floating-point number, whose format is    the same as expected for the subject string of the strtod function.    The corresponding argument shall be a pointer to floating.     decimal-point character appears.  If a decimal-point character    appears, at least one digit appears before it.  The value is rounded    to the appropriate number of digits.

user: user-5
content: double  f,g; sancf("%f %f",&f,&g); printf("%d%d",f,g); 就可以了。。

user: user-0
content: #include<stdio.h> void main() {  float e;  scanf("%f",&e); printf("e=%.12f\n",e);  }  输入3.14  为什么不是3.14000000000

user: user-5
content: 没输入函数，那个只是输出函数。

user: user-6
content: double,Long double 对应lf float 对应f

user: user-0
content: Long double 类型什么输出呢

user: user-7
content: 可以这样理解

user: user-0
content: 这是一一对应的关系吗？

user: user-7
content: c语言中的float 类型的输入用scanf("%f",&i) 但是double类型的数据输入要 用scanf("%lf",&k); 你可以查查c语言double类型的输入

user: user-0
content: 小白一个 不是很懂 求帮助 谢了

user: user-0
content: scanf("%f,%f,",&f,&g);   …掉了

user: user-8
content: 这有输入吗。