[comp.lang.c] Having problems with float and functional prototypes

romwa@gpu.utcs.toronto.edu (Mark Dornfeld) (01/13/89)

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;
}