When I try submitting my code to my prof, I get a compilation error with the following message:
ipc_ms1.c: In function ‘getDbl’: ipc_ms1.c:146:1: warning: control reaches end of non-void function [-Wreturn-type] ipc_ms1.c: In function ‘getInt’: ipc_ms1.c:122:1: warning: control reaches end of non-void function [-Wreturn-type]
I'm not sure what to do
#include <stdio.h>
void welcome(void);
int getInt(void);
double getDbl(void);
void prnTitle(void);
void prnFooter(double gTotal);
void pause(void);
double getDblLimited(double lowerLimit, double upperLimit);
void welcome(void)
{
printf("---=== Grocery Inventory System ===---\n");
}
void prnTitle(void)
{
printf("Row |SKU| Name \t | Price |Taxed| Qty | Min | Total |Atn \n");
printf("----+---+--------------------+--------+-----+-----+-----+------------+|---\n");
}
void prnFooter(double gTotal)
{
printf("--------------------------------------------------------+----------- ------\n");
//float gTotal = 1234.57;
while (gTotal > 0)
{
printf("%12.21f", gTotal);
}
}
void clrKyb(void)
{
char b;
while (b != '\n')
{
scanf("%c", &b);
}
}
void pause(void)
{
printf("Press <Enter> to continue...");
clrKyb();
}
int getInt(void)
{
printf("Enter an interger:");
int d;
char c;
scanf("%d%c", &d, &c);
while (c != '\n')
{
printf("Invalid integer, please try again ");
scanf("%d%c", &d, &c);
}
}
int getIntLimited(int lowerLimit, int upperLimit)
{
int a;
printf("Enter an integer between %d and %d:", lowerLimit, upperLimit);
scanf("%d", &a);
while (a <= lowerLimit || a >= upperLimit)
{
printf("Invalid value, %d < value < %d:", lowerLimit, upperLimit);
scanf("%d", &a);
}
return a;
}
double getDbl(void)
{
double d;
char c;
printf("Enter a floating point number:");
scanf("%lf,%c", &d, &c);
while (c != '\n')
{
printf("Invalid number, please try again ");
scanf("%lf%c", &d, &c);
}
}
double getDblLimited(double lowerLimit, double upperLimit)
{
double a;
printf("Enter a floating point number between %f and %f:", lowerLimit, upperLimit);
scanf("%lf", &a);
while (a <= lowerLimit || a >= upperLimit)
{
printf("Invalid value, %f < value < %f:", lowerLimit, upperLimit);
scanf("%lf", &a);
}
return a;
return 0;
}