Question: #include #include uint 6 4 _ t convert _ to _ base _ ten ( char number [ ] , unsigned int num _ digits,

#include #include uint64_t convert_to_base_ten(char number[], unsigned int num_digits, uint8_t base){
uint64_t value =0;
for (unsigned int i =0; i num_digits; ++i){
value = value * base + to_int(number[i]);
}
return value;
}
void convert_to_base(uint64_t number, uint8_t base, char result[], unsigned int size){
int index = size -2;
result[size -1]='\0';
do {
result[index--]= to_char(number % base);
number /= base;
} while (number >0 && index >=0);
}
uint64_t convert_bases(char number[], unsigned int size, uint8_t base, uint8_t new_base){
uint64_t base_ten_value = convert_to_base_ten(number, strlen(number), base);
convert_to_base(base_ten_value, new_base, number, size);
return base_ten_value;
} Difference:
Found the above differences between solution and student output
Hello, I am not sure what im doing wrong but the outputs are incorrect. I see that the first part of the results are right. Can someone please tell me what I should do?
#include #include uint 6 4 _ t convert _ to _

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!