// Assignment 3 // // Lists characters from the memory starting from a given address // until an end address. // No address control so be careful. // #include int main(void) { char i = 'a'; // A test assignment // char *sptr; char *eptr; FILE *ofile; char filename[30]; sptr = &i ; // sptr points to i, in order to get an example address // printf("--------------------------------------------------------- \n"); printf("Example address, using a simple character assignment (%c) \n",i); printf("Example position: %p \n\n",sptr); printf("Enter a starting address\n"); scanf("%x",&sptr); // Read start address // printf("Enter an ending address\n"); scanf("%x",&eptr); // Read end address // printf("Please type in the name of the file you want the output\n"); scanf("%s",filename); ofile = fopen (filename,"w"); for (; sptr <= eptr; sptr++){ // Move pointer until it reaches the end po. // if (isgraph(*sptr)) { fprintf(ofile,"%c", *sptr); // Printing only readable characters // } } fclose(ofile); return 0; }