c - 二维 float 组值扫描

标签 c arrays floating-point

我用C语言写了一段代码如下:

main()
{
    float x[10][10];  int i,j;   clrscr();
    scanf("%d%d",&i,&j);
    for(i=0;i<3;i++)
        for(j=0;j<3;j++)
            scanf("%f",&x[i][j]);
 ......
}

当我运行这个程序时,有一个异常终止 类似“浮点转换未链接”的错误。
你介意告诉我我弄错了什么吗?

我的操作系统:Windows XP 编译器:TurboC

最佳答案

http://c-faq.com/fp/fpnotlinked.html

Some compilers for small machines, including Turbo C (and Ritchie's original PDP-11 compiler), leave out certain floating point support if it looks like it will not be needed. In particular, the non-floating-point versions of printf and scanf save space by not including code to handle %e, %f, and %g. It happens that Borland's heuristics for determining whether the program uses floating point are insufficient, and the programmer must sometimes insert a dummy call to a floating-point library function (such as sqrt; any will do) to force loading of floating-point support. (See the comp.os.msdos.programmer FAQ list for more information.) A partially-related problem, resulting in a similar error message (perhaps ``floating point not loaded'') can apparently occur under some MS-DOS compilers when an incorrect variant of the floating-point library is linked. Check your compiler manual's description of the various floating-point libraries.

关于c - 二维 float 组值扫描,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1182610/

相关文章:

java - 将 float 从十进制表示转换为 32 位二进制(IEEE 754 浮点)时,指数 (?) 不正确

Python替换 float 只​​给出整数

c - 如何使用 gettimeofday() 或与 Visual Studio C++ 2008 等效的东西?

c - 如何在 pcap 中捕获数据包,并跳过以太网 header

c - 三元 C 运算符如何解释空的第一个分支?为什么?

c - 这段代码如何在不使用 sizeof( ) 的情况下确定数组大小?

java - 如何在java中对具有多个字段的类数组进行排序

python - numpy 结构化数组中的子数组不连续

swift - Swift 中 Float.addProduct 的用途是什么?

c - 如何轻松,快速地学习c基础?