Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions