week 9-10
week 9-10
#include <stdio.h>
#include <string.h>
struct File {
char name[20];
int startBlock;
int numBlocks;
int blocks[100]; // Assuming a maximum of 100 blocks for each file
};
int main() {
int fileCount, choice;
char searchFile[20];
if (choice == 2 || choice == 3) {
printf("Enter blocks for file %d: ", i + 1);
for (int j = 0; j < files[i].numBlocks; j++) {
scanf("%d", &files[i].blocks[j]);
}
}
}
if (choice == 1) {
contiguous_allocation(files, fileCount, searchFile);
} else if (choice == 2) {
linked_allocation(files, fileCount, searchFile);
} else if (choice == 3) {
indexed_allocation(files, fileCount, searchFile);
} else {
printf("Invalid choice\n");
}
return 0;
}