so this program requests a positive integer and if provided, it prints it, if not, it continues to request a positive integer.
This is the code:
#include <stdio.h>
int
get_positive_int(void);
int main(void)
{
int i=get_positive_int();
printf ("%i\n", i);
}
int get_positive_int(void)
{
int n;
do
{
printf("positive integer?: \n");
scanf("%i", &n);
}
while (n<1);
}
My question is, how is the value n returned if there is no return n; at the end? The program runs perfectly with or without return n; Why is that?