Question
[C programming] I'm creating a function that returns a character given the parameters (radix, value). The second part of the function works. For example, if
[C programming]
I'm creating a function that returns a character given the parameters (radix, value). The second part of the function works. For example, if radix is 16 and value is 15, it returns 'F'; if radix is 16 and value is 10, it returns 'A'. However, when radix is 16 and value is anywhere between 0-9, the return output is ' ' (nothing--just single quotation marks with a space). It's suppose to return the value as a character. I'm not sure what I'm doing wrong. I'm trying to return values 0-9 as characters '0' through '9' but the return value is ' '.
This is what my terminal displays
MacBook-Pro:Desktop USER$ gcc -g -Wall numconv.c testConv.c -o testConv
MacBook-Pro:Desktop USER$ ./testConv i2c 16 9
int2char(16, 9) returns ' '
Function is below
char int2char (int radix, int value) {     if(value >= 0 && value         if(value
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started