Professional Documents
Culture Documents
2002 2
2002 2
divided in to four page each page contents array of char from a to z or A to Z characters.
#include <stdio.h>
#include <stdlib.h>
#define PAGE_SIZE 8
#define NUM_PAGES 4
pages[i][j] = start_char + i;
if (start_char == 'Z')
start_char = 'a';
start_char = 'A';
else
start_char++;
printf("Logical Memory:\n");
printf("%c", pages[i][j]);
}
printf("\n");
int main() {
char pages[NUM_PAGES][PAGE_SIZE];
initializePages(pages);
printLogicalMemory(pages);
return 0;
}
Write a program For finding the page number and the offset from the logical address. The program
will accept only a logical address. Call your program: logical_address.c As an example, your
program would run as follows: ./logical_address 7
Your program would output: The logical address=7 contains Page number = 1 offset = 3
#include <stdio.h>
#include <stdlib.h>
#define PAGE_SIZE 4