Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(5 Points) Write C functions to convert a 2\'s complement binary number to decim

ID: 3875237 • Letter: #

Question

(5 Points) Write C functions to convert a 2's complement binary number to decimal and vice versa. I will test the code using function calls similar to below Test for different size binary numbers and decimals. The function prototypes to use are also provided below · Here's what will be in convert.h header file // Takes an array of bits and the length of the bits to return the corresponding // decimal equivalent. int convert_2s_complement_to_decimal(char [], int) II Takes a decimal and a character array with the length specified to return the bit pattern. You must pass enough I/ length to null terminate the string. void convert_decimal_to_2s_complement int, char[l, int length); char data[5] = {'1', '0', '1', 'O', 'O'); printf("decimal value of 10100 is %dn'', convert-2s_complement_to_decima(data, 5)); char data1 [3] = {'0','1', '1'); printf("decimal value of 011 is %din", convert-2s-complement-to, decimal(data 1,

Explanation / Answer

Ans:

Sample:

Results in