Hi ever one
i make a function that print the reverse integer e.g if we input 12345 it print 54321
but the problem is that when i use return b; it print 5 4 3 2 1 1 and when remove return b; then it prints 5 4 3 2 1 4469696 why it print 4469696 after 5 4 3 2 1 here is the code
//HEADER FILES
#include<iostream>
#include<conio.h>
using namespace std;
//START OF FUNCTION PROTOTYPE
int reverseDigit(int number);
//END OF FUNCTION PROTOTYPE
//START OF MAIN FUNCTION
int main ()
{
cout<<"ENTER ANY INTEGER IT WILL REVERSE THE INTEGER AND PRINT IT."<<endl;
cout<<"The reverse integer is = ";
cout<<reverseDigit(12345);
cout<<endl;
getch();
return 0;
}//END OF MAIN FUNCTION
//START OF FUNCTION BODY
int reverseDigit(int number)
{
int b ;
while(number > 0)
{
b=number%10;
number= number/10;
cout<<b<<" ";
}
//return b;
}
//END OF FUNCTION BODY