In C please, Thank you
(3) Write a function that will print an integer in binary format. HINT: start at the highest order bit, which for a 4-byte integer would be bit 31. Mask off that bit (see if it is a 0 or 1), then print out either a 0 or 1 accordingly. Decrement bitnum until all bits have been printed out (while bitnum is greater than or equal to zero). void PrintBinary(int value){ printf("0b"); // prefix with Ob // if sizeof(int) ==4, starts at bit 31 int bitnum = sizeof(int) 8 - 1;
(3) Write a function that will print an integer in binary format. HINT: start at the highest order bit, which for a 4-by
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
(3) Write a function that will print an integer in binary format. HINT: start at the highest order bit, which for a 4-by
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!