Get rid of the segmentation fault error.
/* The first command-line argument is the number of seconds to set a timer to run.
 * The second argument is the name of a binary file containing 100 ints.
 * Assume both of these arguments are correct.
 */

int main(int argc, char **argv) {
    if (argc != 3) {
        fprintf(stderr, "Usage: time_reads s filename\n");
        exit(1);
    }
    seconds = strtol(argv[1], NULL, 10);

    FILE *fp;
    if ((fp = fopen(argv[2], "r")) == NULL) {
      perror("fopen");
      exit(1);
    }

    /* In an infinite loop, read an int from a random location in the file,
     * and print it to stderr.
     */
    for (;;) {
      // get a random number between 0 and the size of the file:
      fseek(fp, 0, SEEK_END);
      // get current position of the file pointer
      int curr_pos = ftell(fp);
      // get random location
      int random_location = random() % curr_pos;
      fseek(fp, random_location, SEEK_SET);
      // read from random location
      int *random_int = 0;
      fread(random_int, sizeof(int), 1, fp);
      fprintf(stderr, "%d\n", *random_int);
    }
    return 1; // something is wrong if we ever get here!
}