#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{ FILE *fp, *fp1 ;
  int i ;
  unsigned char buf [256] ; 	      //this will hold contents of a page
  unsigned short int Addresses[512] ; //these are the randomly generated logical 				      			//addresses 					//against which you will run your code 				     
  unsigned short int Current ;	      //current logical address generated by "CPU"      
 
  srand(9) ; // all get same addresses
  
  for(i = 0; i < 512 ; i++) 		//generate/print addresses. Print not necessary
        {
	  Addresses[i] = rand() % 65535 ;
          printf("Address is %u \n", Addresses[i]) ;
        }

 //declare RAM and init to 0s
  
  unsigned char RAM [64][256] =  { [0 ... 63] = { [0 ... 255] = 0 } };

 // initialize contents of page

 for (i = 0 ; i < 256 ; i++)
        buf[i] = (unsigned char) i ;

 // fill in backing store ('disk'), implemented as a binary external file, with 256 pages

 fp = fopen("Back.bin", "wb") ;
  for (i = 0; i < 256 ; i++)
        fwrite(buf,256, 1, fp) ;

   fclose(fp) ;
   fp = fopen("Back.bin", "rb") ;

 // do your thing!!

    for(i = 0 ; i < 512 ; i++)
	{ Current = Addresses[I] ; //rest of program
