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 ' '.

[C programming] I'm creating a function that returns a character given the

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 ' '

parameters (radix, value). The second part of the function works. For example,

Function is below

char int2char (int radix, int value) { &nbsp&nbsp&nbsp&nbspif(value >= 0 && value &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif(value

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 Databases Questions!