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

Help with these functions would be appeciated. Needs to be written in C. Write t

ID: 3535109 • Letter: H

Question

Help with these functions would be appeciated. Needs to be written in C.

Write the C functions described below. It is essential that your C functions follow
the names and arguments described below (we will write code that calls your functions!).
Your function definitions will be linked with our main code, so you just need to write the code for the two functions listed below. Feel free to write other functions as well, the only
requirement is that you include the functions listed below.

First Function:

Generating binary (ASCII encoded) from a char: print_binary_char void print_binary_char(char x);
You need to write the function print_binary_char that generates output to stdout that displays the binary representation of an 8 bit character x. For example, if print_binary_char(0x35) is called, the function should print the string "00110101".
Your function must work with any char value x! The easiest way to do this is to use binary logic operations to examine the bits of x one at a time. You might also find the shift operators will be useful.

Second Function:

Generating binary (ASCII encoded) from an int: print_binary_int void print_binary_int(int x);
You need to write the function print_binary_int that generates output to stdout that displays the binary representation of 32 bit integer x. For example, if print_binary_int(0x01234567) is called, the function should print the string: 00000001001000110100010101100111
Your function must work with any int value x! The easiest way to do this is to use your print_binary_char function on each of the bytes that make up the integer x. Be careful about byte ordering!
Help with these functions would be appeciated. Needs to be written in C.

Write the C functions described below. It is essential that your C functions follow
the names and arguments described below (we will write code that calls your functions!).
Your function definitions will be linked with our main code, so you just need to write the code for the two functions listed below. Feel free to write other functions as well, the only
requirement is that you include the functions listed below.

First Function:

Generating binary (ASCII encoded) from a char: print_binary_char void print_binary_char(char x);
You need to write the function print_binary_char that generates output to stdout that displays the binary representation of an 8 bit character x. For example, if print_binary_char(0x35) is called, the function should print the string "00110101".
Your function must work with any char value x! The easiest way to do this is to use binary logic operations to examine the bits of x one at a time. You might also find the shift operators will be useful.

Second Function:

Generating binary (ASCII encoded) from an int: print_binary_int void print_binary_int(int x);
You need to write the function print_binary_int that generates output to stdout that displays the binary representation of 32 bit integer x. For example, if print_binary_int(0x01234567) is called, the function should print the string: 00000001001000110100010101100111
Your function must work with any int value x! The easiest way to do this is to use your print_binary_char function on each of the bytes that make up the integer x. Be careful about byte ordering!
Generating binary (ASCII encoded) from a char: print_binary_char void print_binary_char(char x);
You need to write the function print_binary_char that generates output to stdout that displays the binary representation of an 8 bit character x. For example, if print_binary_char(0x35) is called, the function should print the string "00110101".
Your function must work with any char value x! The easiest way to do this is to use binary logic operations to examine the bits of x one at a time. You might also find the shift operators will be useful.

Second Function:
Generating binary (ASCII encoded) from an int: print_binary_int void print_binary_int(int x);
You need to write the function print_binary_int that generates output to stdout that displays the binary representation of 32 bit integer x. For example, if print_binary_int(0x01234567) is called, the function should print the string: 00000001001000110100010101100111
Your function must work with any int value x! The easiest way to do this is to use your print_binary_char function on each of the bytes that make up the integer x. Be careful about byte ordering!

Explanation / Answer

Please rate with 5 stars :)


Here you go: (1st function)


http://ideone.com/tko41t


The second one is even simpler. I leave it to you :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote