I need to Write a program la2pa in C that translates a logical address to a physical address. The page table should be read from a file. The program takes two inputs, a page table file and a logical address, and produces one output, a physical address
I will provide you a page table file with the following format
where the first line gives the page size, the rest of the file give a mapping between the logical page and the physical page. ‘-1’ means the page is not mapped.
Your program must handle abnormal inputs
If the input is an invalid logical address, your program must print “invalid logical address”
If the input is an unmapped logical address, your program must print “page fault”
Both the input and the output of the program should be in hexadecimal format.