I keep getting the error , "control may reach end of non-void function" What am I doing wrong here? I just dont get it right now! I know its something simple and small but I have been here back and forth for about 2 hours wondering what the hell is going on. Sorry I am just venting... Any help would be greatly appreciated!
int main()
{
int number ;
int number_rev = 0;
printf("Enter a number to reverse: ");
scanf("%d",&number);
printf("\nReverse of entered number is = %d\n", result (number, number_rev));
}
int result (int number, int number_rev)
{
while (number != 0)
{
number_rev = number_rev * 10;
number_rev = number_rev + number % 10;
number = number/10;
return number_rev;
}
}