OK. Here's the code:
***********************************
#include <stdio.h>
struct entry {
int value;
struct entry *next; };
struct entry *findEntry (struct entry *initial, int toLookFor) {
struct entry *pointer_to_result = initial;
while (((*pointer_to_result).value != toLookFor) && (pointer_to_result !=0))
{pointer_to_result = (*pointer_to_result). next;}
return pointer_to_result;}
int main (void) {
struct entry a, b, c, d, e, f;
printf("\nValue a:"); scanf("%i", &a.value);
printf("\nValue b:"); scanf("%i", &b.value);
printf("\nValue c:"); scanf("%i", &c.value);
printf("\nValue d:"); scanf("%i", &d.value);
printf("\nValue e:"); scanf("%i", &e.value);
printf("\nValue f:"); scanf("%i", &f.value);
struct entry *initial = &a, *result;
a.next = &b;
b.next = &c;
c.next = &d;
d.next = &e;
e.next = &f;
f.next = 0;
int n, max;
printf("\nHow many times do you want the program to run?\n");
scanf("%i", &max);
for (int i = 0; i < max; i++) {
printf("\nPlease enter value to find:"); scanf ("%i", &n);
result = findEntry (initial, n);
if (result != 0) printf ("\nThe entry %i was found\n", (*result).value);
else printf ("\nThe entry %i wasn't found\n", n); }
return 0; }
************************************************************
The program asks the user to enter a list of numbers. Then, the user is asked to enter any number, and the program is meant to find out whether the number is in the list. If the number is in the list, the program works fine and finds it. The crash occurs when the number entered is not in the list.