Why only 0 printed ? fp points to file containing 100 integers from 0 to 99
FILE *fp;
if ((fp = fopen(argv[2], "r")) == NULL) {
    perror("fopen");
    exit(1);
}

for (;;) {
    int num = (random() * 99) / RAND_MAX;
    fseek(fp, SEEK_SET, num);
    int *ptr = malloc(sizeof(int));
    fread(ptr, sizeof(int), 1, fp);
    printf("#%d#\n", *ptr);
}