I'm trying to reverse the digits of an integer. To do this I am:
- Taking the integer.
- Putting it into a string.
- Putting the string into another string in reverse.
- Converting the reversed string to a proper integer.
I've sort of gotten to step 3, and while it does reverse the string properly, it leaves me with a lot of odd data.
 The top part is just the array lengths to compare.
What is happening for this odd data?
The top part is just the array lengths to compare.
What is happening for this odd data?
int ReverseNumber(int Num) {
//Variables
int i = 0;
int j = 0;
char Number[50];
char ReversedNumber[50];
sprintf(Number,"%d", Num);
//Finding Length Of Array
do{ 
    i++;
}while(Number[i] > 10);
//i - 1(Due to Array Length)
i--;
//Reverseing
do {
    printf("%d | %d \n",j,i);
    ReversedNumber[j] = Number[i];
    printf("%c\n", ReversedNumber[j]);
    getch();
    i--;
    j++;
} while (i != -1);
int NumberLength = (strlen(Number) - 1);
//Printing
printf("%s\n", Number);
printf("%s\n", ReversedNumber);
}
 
     
    