using floats in functional prototypes
Royal Ontario Museum
romwa at gpu.utcs.toronto.edu
Thu Jan 19 00:25:22 AEST 1989
I am reposting this query because I didn't receive any replies
to my original posting. Can someone help out?
I am having some problems with using float's in functional
prototypes and am hoping that someone out there in netland can
help me out. The problem seems to be isolated to float types
and not to any other types. The examples below give the gist
of it. Tst2.c has a function "afunc" with one parameter.
When I compile the two files, I get a warning that the type of
the argument in the prototype doesn't match the declaration
(??). I experimented with this example a bit on a couple
of compilers and each time the warnings come out. What is
more disconcerting is that flt_val inside afunc isn't 6.5 but
some bizarre value.
A couple of other observations are that by changing
the type to be double made everything work, and by removing
the prototypes made everything work. Since MS-C 5.1, QuickC,
and Turbo C give similar results I assume it is something
about C that I don't understand.
advTHANKSance
Totally Perplexed,
Pavneet Arora
...!utgpu!rom!pavneet
Royal Ontario Museum
100 Queen's Park
Toronto, Ontario
M5S 2C6
(416) 585-5626
---------tst.c-------------------------------------------------
#include <stdio.h>
void afunc( float );
void main( void )
{
float flt_val = 6.5;
afunc( flt_val );
}
---------tst2.c------------------------------------------------
#include <stdio.h>
void afunc( float );
void afunc( flt_val )
float flt_val;
{
int i;
i = 3;
}
More information about the Comp.lang.c
mailing list