-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem-36
More file actions
43 lines (35 loc) · 990 Bytes
/
problem-36
File metadata and controls
43 lines (35 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct Block {
int data;
struct Block *next;
} Block;
Block* createBlock(int data) {
Block *newBlock = (Block*)malloc(sizeof(Block));
newBlock->data = data;
newBlock->next = NULL;
return newBlock;
}
void addBlock(Block **head, int data) {
Block *newBlock = createBlock(data);
Block *temp = *head;
if (*head == NULL) {
*head = newBlock;
return;
}
while (temp->next != NULL) {
temp = temp->next;
}
temp->next = newBlock;
}
void readBlocks(Block *head) {
Block *temp = head;
while (temp != NULL) {
printf("Block data: %d\n", temp->data);
temp = temp->next;
}
}
int main() {
Block *head = NULL;
addBlock[_{{{CITATION{{{_1{](https://github.com/sunny2028/DS-IN-CPP/tree/7f888d119531cc0e5a75a2601772c12c66c51ea8/Data%20Structure%20practice%2Fqueue%2FProgram%20for%20Page%20Replacement%20Algorithms%20FIFO.cpp)