"Unlinked floating point" problem

This is a discussion on "Unlinked floating point" problem within the C Programming forums, part of the General Programming Boards category; hi, Code: #include<stdio.h> struct xyz { float foo[5]; float bar; }*x[5]; void main() { scanf("%f",&x[0]->foo[0]); } When i try to ...

  1. #1
    Registered User
    Join Date
    Aug 2005
    Location
    New Delhi
    Posts
    40

    "Unlinked floating point" problem

    hi,

    Code:
    #include<stdio.h>
    
    struct xyz
    {
         float foo[5];
         float bar;
    }*x[5];
    
    void main()
    {
        scanf("%f",&x[0]->foo[0]);
    }
    When i try to compile the above code( using Turbo C++ 3.0 in 16-bit DOS), the program terminates with this message:

    scanf: floating-point math package not linked
    Abnormal program termination


    To Quote from the manual, When using float datatypes, linking with the floating-point package is mandatory, Turbo C++ will automatically do this for you if you use float in your code

    Then why this error and how am I supposed to fix it?

    Thanks In Advance,
    Sahil

    P.S This is my first thread, hello to everyone over here

  2. #2
    Registered User
    Join Date
    Aug 2005
    Location
    New Delhi
    Posts
    40
    i got my answer here:

    http://cboard.cprogramming.com/showt...171#post322171

    funny i am replying to my own post(on my first post itself).
    thanks
    sahil

  3. #3
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,266
    Yeah, the use of ancient compilers has that unfortunate side effect.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    42
    Unless I'm mistaken, you're also reading your value into unallocated memory, unless this isn't your actual code. You've declared x[0] to be a pointer to a struct, but the actual struct for x to point to is never allocated.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM
  2. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  3. Problem with rounding floating points
    By MacNilly in forum C++ Programming
    Replies: 3
    Last Post: 02-17-2006, 01:01 PM
  4. Problem with floating point numbers
    By thetinman in forum C++ Programming
    Replies: 3
    Last Post: 11-13-2005, 06:55 PM
  5. Replies: 5
    Last Post: 11-07-2005, 11:34 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21