Pelles C forum

C language => Beginner questions => Topic started by: cyclops on May 16, 2010, 01:16:05 PM

Poll
Question: showing me this warning error : missing prototype
Option 1: good votes: 0
Option 2: bad votes: 0
Title: missing protoptype
Post by: cyclops on May 16, 2010, 01:16:05 PM
/*         warning #2027: Missing prototype for 'printline'.
              Missing prototype for 'value'.
*/


#include<stdio.h>
void value();
int main()
{
   void printline();
    void value();
   void printline();
}
void printline()
{
   for(int i=0;i<20;i++)
      printf("%c",'-');
   printf("\n");
}
void value()
{
   float principal,inrate,sum;
   int period,year;
   printf("Enter principal, inrate, year :\n");
   scanf("%f%f%d",&principal,&inrate,&period);
   sum=principal;
   year = 1;
   while (year<=period)
   {
      sum =sum*(1+inrate);
      year++;
   }
   printf("%f\t%f\t%f\n",principal,inrate,sum);
   
}
Title: Re: missing protoptype
Post by: Vortex on May 16, 2010, 01:22:43 PM
You should not place those prototypes in the main function. They should come like the following :

#include<stdio.h>

void printline();
void value();
void printline();
.
.
.