Dear friends,
Please consider the following C program.
#include<stdio.h>
struct employee
{
int id;
float sal;
};
main()
{
struct employee emp[5];
int i=1;
scanf("%f",&emp[i].sal);
return 0;
}
When I run the follwoing C program on TurboC++ Version 3.0 on Windows
it shows the error,
scanf: floating point format not linked.
Abnormal program termination
Please tell me why this happens.
The same code shows no error when I replace the variable 'i' in the scanf statment
with an interger, like
scanf("%f",&emp[1].sal);
Please tell me what is wrong with the code.
Lal
|
|
0
|
|
|
|
Reply
|
sreelalpp (11)
|
8/12/2004 3:27:25 PM |
|
On Thu, 12 Aug 2004, sreelal wrote:
> Dear friends,
>
> Please consider the following C program.
>
>
> #include<stdio.h>
>
> struct employee
> {
> int id;
> float sal;
> };
>
> main()
> {
> struct employee emp[5];
> int i=1;
> scanf("%f",&emp[i].sal);
>
> return 0;
> }
>
>
>
> When I run the follwoing C program on TurboC++ Version 3.0 on Windows
> it shows the error,
>
> scanf: floating point format not linked.
> Abnormal program termination
>
> Please tell me why this happens.
Your compiler does not support floating point math by default. You need to
read your compiler documentation to understand how to enable this.
> The same code shows no error when I replace the variable 'i' in the scanf statment
> with an interger, like
>
> scanf("%f",&emp[1].sal);
>
> Please tell me what is wrong with the code.
>
>
> Lal
>
--
Send e-mail to: darrell at cs dot toronto dot edu
Don't send e-mail to vice.president@whitehouse.gov
|
|
0
|
|
|
|
Reply
|
darrell14 (26)
|
8/12/2004 4:07:41 PM
|
|
sreelal wrote:
> Please consider the following C program.
[snipp]
> scanf("%f",&some_float);
[ I hope that this simple line will already trigger the error and that you
just neglected to make the smallest possible example from it. ]
> When I run the follwoing C program on TurboC++ Version 3.0 on Windows
> it shows the error,
>
> scanf: floating point format not linked.
> Abnormal program termination
Question: did you run the program or did you compile it to produce that
output? Anyhow, it looks like support for floatingpoint operations was not
compiled in, which makes sense when compiling for machines without an FPU,
e.g. prehistoric personal computers.
> Please tell me why this happens.
Your program is (mostly) fine, so the issue is rather with your compiler.
Take the issue to a newsgroup where that compiler is on topic.
Maybe even better, switch to a modern compiler, DevC++(no, it's not just
for C++) comes for free and with a modern compiler.
Uli
|
|
0
|
|
|
|
Reply
|
doomster121 (274)
|
8/12/2004 4:15:48 PM
|
|
sreelal wrote on 12/08/04 :
> scanf: floating point format not linked.
> Abnormal program termination
>
> Please tell me what is wrong with the code.
Nothing. It's a well known issue of BOrland C compilers. Add this at
the top of the source file:
#ifdef __BORLANDC__
/* The pesky "floating point format not linked" killer hack : */
extern unsigned _floatconvert;
#pragma extref _floatconvert
#endif
--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
"C is a sharp tool"
|
|
0
|
|
|
|
Reply
|
emdel (952)
|
8/12/2004 4:30:57 PM
|
|
hi,
i am getting an error like
[test.o] Error 255
please help me to find out the problem..
thanks in advance,
Subashini
|
|
0
|
|
|
|
Reply
|
subashinicv (2)
|
8/17/2004 1:25:12 PM
|
|
subashini <subashinicv@ctd.hcltech.com> scribbled the following:
> hi,
> i am getting an error like
> [test.o] Error 255
> please help me to find out the problem..
Not knowing which compiler you are using, you might as well say "I'm
getting some weird error" and expect us to be able to fix your code.
Error 255 might mean anything from a missing semicolon to an internal
bug in the compiler. We have as much chance of knowing which specific
error it is as we have of knowing the contents of your wallet.
--
/-- Joona Palaste (palaste@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"The trouble with the French is they don't have a word for entrepreneur."
- George Bush
|
|
0
|
|
|
|
Reply
|
palaste (2323)
|
8/17/2004 1:34:10 PM
|
|
hi,
i am trying to compile my C code in montavista development environment. &
getting the error as
"*** [test.o] Error 255"
& i am getting no other compilation error.
Please help me to solve the error.
Thanks in advance,
Subashini
|
|
0
|
|
|
|
Reply
|
subashinicv (2)
|
8/18/2004 5:42:58 AM
|
|
|
6 Replies
48 Views
(page loaded in 0.091 seconds)
Similiar Articles: bad pointer exception - comp.lang.c++Anyway, the Standard imposes no requirements on the code that dereferences an uninitialized pointer. Generating a run-time error falls under that definition - nothing ... fread and float - comp.soft-sys.matlab... this MBF format to IEEE and I found this code ... error:Attempted to access F2(6); index must be a ... sizeofFloat,500,f); if i change double pointer to float pointer ... textread error: Trouble reading floating point number from file ...... for example), but I keep getting this error message: ??? Error using ==> dataread Trouble reading float... ... Porting Mathlab code to C++ - accuracy problem - comp.soft-sys ... recvfrom returns with an error code of 14, EFAULT "Bad Address ...I know that I'm not handling any errors in my code as it is still very early in development. ... You have to pass in the pointer to the place where you >> want the data written ... Static const integral data members can be initialized? - comp.lang ...Why do Microsoft C++ Compiler reports: error C2864 ... On 07/23/10 09:42 AM, Immortal Nephi wrote: > > float ... could cause the compiler to generate initialization code ... Passing a std::vector pointer as a long ??? - comp.lang.c++ ...... 1183): warning C4514: 'std::numeric_limits<float>::round_error ... system_error(196): warning C4514: 'std::error_code ... > > The problem is that it's possible for a pointer to ... Explanation needed for const int "error: variably modified ... at ...Hi, The following code results in the following error with GCC (v.4.3.2): const int eodSize ... 24: 23.11.2009 - 20:33 Pointer to a member variable in a struct without ... How to check whether malloc has allocated memory properly in case ...In my code examples How to check whether malloc ... verbatim from the MS Fortran reference, typing errors ... that mapped these declarations to the 60-bit floating ... const reference typedef compile error: - comp.lang.c++.moderated ...... is due to the meaning of "const reference" in your code. ... This is the error in gcc 3.4.6: > > typedef.cpp: In ... the FAQ, it explains the differences between e.g. pointer ... "TYPEDEF PTR with STRUCT" masm32 - comp.lang.asm.x86Hello. My problem: I have a struct and a function with a pointer to the struct as parameter. But the following program code causes an error: "error A... Floating pointer Error in a code - C / C++sreelal wrote on 12/08/04 :[color=blue] > scanf: floating point format not linked. > Abnormal program termination > > Please tell me what is wrong with the code ... Tutorial: Pointers in C and C++ - August CouncilThe above code shows that there is nothing magical ... Line (2) shows that fptr is created as a float pointer, that is ... Corrected spelling errors 2005 December 1 Added tarball ... 7/6/2012 7:55:20 AM
|