#include <stdio.h>
int input();
int inputRep(int);
int reply(int msg) {
int rep = inputRep(msg);
if (msg > 0) return rep;
}
void main(void) {
int ch = input(), ans;
if (ch<10)
ans = reply(ch);
else
ans = reply(10);
printf("The answer is %d.",ans);
}In this example, in the first branch of the if statement,
the value of ch can be divided into two ranges:
ch < = 0: For the function call reply(ch),
there is no return value.
ch > 0 and ch <
10: For the function call reply(ch),
there is a return value.
Therefore the Function not returning value check
returns an orange error on the definition of reply().
Correction — Return value for all
inputsOne possible correction is to return a value for all
inputs to reply().
#include <stdio.h>
int input();
int inputRep(int);
int reply(int msg) {
int rep = inputRep(msg);
if (msg > 0) return rep;
return 0;
}
void main(void) {
int ch = input(), ans;
if (ch<10)
ans = reply(ch);
else
ans = reply(10);
printf("The answer is %d.",ans);
}