delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/05/22:31:56

From: demandrd AT compusmart DOT ab DOT ca (Demandred)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: newbie question
Date: Sun, 05 Jan 1997 23:02:17 GMT
References: <32cd9e4f DOT 6800703 AT news DOT value DOT net>
NNTP-Posting-Host: remote468.compusmart.ab.ca
Message-ID: <32d0330a.0@ntnews.compusmart.ab.ca>
Lines: 38
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

wildthing AT value DOT net (Wild Thing) wrote:

>Whenever I prototype a function in DJGPP, RHIDE tells gives me a
>warning when I try to compile the program.
>for example:

>// my c program
>#include <stdio.h>
>#include <conio.h>
>newFunction(int i);	// prototype
>main()
>{
> int i = 5;
> clrscr();
> printf("blah blah");
> newFunction(i);
> return 0;
>}
>newFunction(int i)
>{
> printf(" %d", i);
> return 0;
>}

>sorry about the bad example, i'm just learning c and had to think of
>it off the top of my head.. anyhow, when i try to compile it under
>rhide with djgppv2 it says "warning: newFunction() has no data type or
>something or other".. but the program works fine if i remove the
>prototype at the top.. is this normal?

I don't know if it's the cause of your problem, but you don't declare
the return data type in either the prototype or the function
definition.  Try:

int newFunction(int i);

as the function prototype.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019