Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ncrlnk!ncrstp!mercer From: mercer@ncrstp.StPaul.NCR.COM (Dan Mercer) Newsgroups: comp.lang.c Subject: Re: prototype my function, please... Keywords: prototype Message-ID: <457@ncrstp.StPaul.NCR.COM> Date: 25 May 90 00:01:51 GMT References: <1231@wet.UUCP> Reply-To: mercer@ncrstp.StPaul.NCR.COM (Dan Mercer) Organization: St. Paul Lines: 79 In article <1231@wet.UUCP> noah@wet.UUCP (Noah Spurrier) writes: : : :I get the bad feeling that I am going to get flamed for this... But I can :see no reason why my Turbo C compiler does not like the way I prototype :the following program. : :#include : :/* Prototype */ :void x (float); : :void main () :{ : x ((float)1); :} : :void x (y) :float y; :{ : printf ("%f",y); :} : :I keep getting a type mismatch error in function x() parameter float y; :If I delete the prototype line the program works fine, but with warnings. : :Also just to make sure I was seeing straight I tried this nearly identical :program. : :#include : :/* Protoypte */ :void x (int); : :void main () :{ : x (1); :} : :void x (y) :int y; :{ : printf ("%d",y); :} : :This works just fine, no warnings, no errors. Maybe I can't see the forest for :the trees, so I am hoping someone else can take a chain-saw to this one... :Oh if had only paid attention that day in class when they explain EXACTLY why :I can't do what I am trying to do. : :I hope anyone can help... : :yours, : :Noah Spurrier :noah@WET.UUCP Maybe try the following: /* Prototype */ void x (float); void main () { x ((float)1); } void x (float y) <======== change to ANSI declaration style { printf ("%f",y); } My Turbo C has a fit if I mix ANSI declarations with old style declarations (makes porting code a real bitch) -- Dan Mercer Reply-To: mercer@ncrstp.StPaul.NCR.COM (Dan Mercer)