Question: You need to implement functions createBitArray and createBitmap in bitmaps.c . The first function is supposed to help in the implementation of the second. The

You need to implement functions createBitArray and createBitmap in bitmaps.c.
The first function is supposed to help in the implementation of the second.
The createBitArray function sets (i.e. gives the value 1 to) times of the rightmost bits in
a bit_array starting from index position. For example, createBitArray(3,1)
should return 00001110: there are three bits set with the first one at index position 1, if we
count indices right to left (the first index being 0).
The number of bit arrays that should be contained in a bitmap is controlled by the times
parameter of the createBitmap function. The id parameter is just used to set the offer_id
of the bitmap struct. The times value is expected to satisfy times>0 and times<=D. The
bit arrays that are created should have their ones at consecutive positions.
expected output:
Bitmap/Offer id: 0
Bitarrays:
0: 00000001
1: 00000010
2: 00000100
3: 00001000
4: 00010000
Bitmap/Offer id: 1
Bitarrays:
0: 00000011
1: 00000110
2: 00001100
3: 00011000
4: 0
Bitmap/Offer id: 2
Bitarrays:
0: 00000111
1: 00001110
2: 00011100
3: 0
4: 0
Bitmap/Offer id: 3
Bitarrays:
0: 00001111
1: 00011110
2: 0
3: 0
4: 0
Bitmap/Offer id: 4
Bitarrays:
0: 00011111
1: 0
2: 0
3: 0
4: 0
scheduler.h:
#include
#include
#define L 50// maximum number of characters in a name
#define D 5// number of days of instruction in the schedule
typedef struct person_struct {
char name[L];
struct person_struct * next;
} person;
typedef struct teaching_offer {
int id; // unique identifier for offer
int times;
char grade[L];
person * teacher; // one or more lead teachers
person * assistant; // one or more assistants
struct teaching_offer * next;
} offer;
typedef unsigned char bit_array; // D should be less than 8
typedef struct bitmap_struct {
int offer_id;
bit_array b[D];
struct bitmap_struct * next;
} bitmap;
void printOffer (offer * k);
void printBinary (char n);
void printBitmap (bitmap * m);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!