Re: getting an error in a program



sudhanshu gupta wrote:
Its a IrisGL program I am attaching i am getting an error

sudhanshu@sudhanshu-laptop:~/isosurface$ gcc isonm.c
isonm.c: In function 'readFile':
isonm.c:142: warning: format '%d' expects type 'int *', but argument
3 has type 'float *'

Can anyone tell me how to remove that....

The error message tells you that for format '%d' there should be an int
object but you are using a float object. As you want to use a float
object you need format '%f'. Therefore change line 142 from

fscanf(infile,"%d",&coord);

to

fscanf(infile,"%f",&coord);


Nils

--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



Relevant Pages

  • Re: short float ???
    ... you mention that "this format is used in the NVIDIA graphic cards, ... floatingpoint" format natively? ... we now have two competing hardware definitions for a "short float". ...
    (comp.std.c)
  • Re: short float ???
    ... you mention that "this format is used in the NVIDIA graphic cards, ... floatingpoint" format natively? ... Although those specific platforms are fairly popular, ... float", or will standard promotion rules apply and computations be ...
    (comp.std.c)
  • Re: Socket & PrintWriter issue-- writing a float to a C client
    ... memcpy(&flt, buffer, 4); ... such as that a float is represented in C memory as 4 ... bytes in IEEE little-endian format -- in which case something like the above ...
    (comp.lang.java.programmer)
  • Re: Accounting changes
    ... 32-bit float format. ... This is the C "float" type on all the architectures we support. ... I could add a typedef clarifying this, but I doubt we'll ever support an architecture where float is a different format. ... these features are provided at no cost by the processor hardware and the C library. ...
    (freebsd-arch)
  • Re: Translating binary files written on 64 bit machine on a 32 bit machine
    ... > windows computer, with c code compiled in Microsoft visual studio .NET. ... internal format is the same as the layout on disc, ... > float types. ... might not only have to use the proper type (float, double, long double) ...
    (alt.comp.lang.learn.c-cpp)