4. Write C code to implement the tuncion quicu functions one to funct queue-sche
ID: 3577219 • Letter: 4
Question
4. Write C code to implement the tuncion quicu functions one to funct queue-scheduling architecture. Your code should have two add a function pointer to the back of the queue and one to read the first item from the of the queue. The latter function can return a pointer if front Figure 5.11 Another Architecture static WORD w Signals; define SIGNAL A 0x0001 define SIGNAL B 0x0002 define SIGNAL C 0x0004. ildefine SIGNAL D 0x0008 void interrupt vHandleDeviceA (void) Reset device A Signals SIGNAL A void interrupt v HandleDevice (void) Reset device B signals I- SIGNAL B (continued)Explanation / Answer
// to insert elements in queue
void insert()
{
struct node *temp;
temp = (struct node*)malloc(sizeof(struct node));
printf("Enter value to be inserted ");
scanf("%d", &temp->data);
temp->link = NULL;
if (rear == NULL)
{
front = rear = temp;
}
else
{
rear->link = temp;
rear = temp;
}
}
// returns first element of queue
void first_element()
{
if (front == NULL)
{
printf("**************** The queue is empty **************** ");
}
else
printf("**************** The front element is %d *********** ", front->data);
}
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.