L
Liux
These codes cause an error "Floating point format not linked" while running,
compiled with turbo c 2.0 and 3.0:
--------------------------
#include <stdio.h>
#include <stdlib.h>
struct type {
float a;
};
struct type x[1];
int
main(void)
{
int n = 0;
scanf("%f", &x[n].a);
return EXIT_SUCCESS;
}
--------------------------
What is odd is that when "&x[n].a" is changed to "&x[0].a", the problem
never occurs.
Whatever the size of the array x, and which value n is assigned, the error
occurs as long as i use n to replace the constant number.
I compile this with gcc and it's alright, but is it just a problem of
borland programmers? Is it something in this program that's not compatible
with The Ansi Standard?
Of course i don't want to introduce any platform based topic here, but i am
just confused about this c programming problem. Can anybody help me? Thank
you very much!
compiled with turbo c 2.0 and 3.0:
--------------------------
#include <stdio.h>
#include <stdlib.h>
struct type {
float a;
};
struct type x[1];
int
main(void)
{
int n = 0;
scanf("%f", &x[n].a);
return EXIT_SUCCESS;
}
--------------------------
What is odd is that when "&x[n].a" is changed to "&x[0].a", the problem
never occurs.
Whatever the size of the array x, and which value n is assigned, the error
occurs as long as i use n to replace the constant number.
I compile this with gcc and it's alright, but is it just a problem of
borland programmers? Is it something in this program that's not compatible
with The Ansi Standard?
Of course i don't want to introduce any platform based topic here, but i am
just confused about this c programming problem. Can anybody help me? Thank
you very much!