Write a \"C\" language program to expand the following 16 bit data field into a
ID: 3776279 • Letter: W
Question
Write a "C" language program to expand the following 16 bit data field into a 32 bit data field. Original 16 bit data field contains the following: Subject 4 bits Time start 4 bits Number of hours 2 bits Room number 2 bits College 2 bits Program 2 bits A B C D E F F-B A-8 7-6 5-4 3-2 1-0 This data needs to be expanded to the following 32 bit data field Subject 6 bits Time start 6 bits Time end 6 bits College 6 bits Program 8 bits A B C D E 1F-1A 19-14 13-E D-8 7-0 Time end = Time start + Number of hours and the time is base on a 24-hour clock. Use the following model to complete your program. Convert (unsigned short *old, unsigned long *new);Explanation / Answer
#include <stdio.h>
struct A
{
unsigned char subject;
unsigned int time start ;
unsigned int time ebd ;
unsigned char college ;
unsigned char program ;
};
int main()
{
A a = {6. 6. 6. 6. 8}
printf("%d", size of (struct A) );
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.