I believe I am building my linked list correctly. Now I need help to write a function that will allow me to search two elements of the data and return the third. This program is suppose to accept 3 integers from the user the first one represents city #1 and the second represents city #2 and the third will represent the distance between the two. I have the program completed (not finalized) but need to write a function that will allow the user to enter 2 integers representing cities they previously entered into the linked list, search the list for those two values, then print what the distance was between those two cities. I need help with what to pass the function and how I would go about writing it. I have function for startscreen that I am not sending because it is irrelevant. Here is the code I have:

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

#define FALSE 0
#define TRUE 1

void StartScreen(void);
typedef struct node NODE_t;

struct node
{
int City1;
int City2;
int Distance;
};

int main()
{
char Repeat;
int SelCity1;
int SelCity2;
int TargetDistance;

StartScreen();
do
{
current_node->next = new_node;
current_node = new_node;
printf ("\n\nPlease enter 3 integers a b c: ");
scanf ("%d %d %d", &(new_node->City1), &(new_node->City2), &(new_node->Distance));
fflush(stdin);
printf("\nWould you like to enter 3 more integers? (y/n) ");
scanf("%c", &Repeat);
if (Repeat == 'y' || Repeat == 'Y')
else if (Repeat == 'n' || Repeat == 'N')
{
printf("\nWhat distance would you like to find? ");
scanf("%d %d", &SelCity1, &SelCity2);
TargetDistance = TraverseList(SelCity1, SelCity2);
printf("\nThe distance between cities %d and %d is %d.", SelCity1, SelCity2, TargetDistance);
}
}

do
{
printf ("memory location: %p\n", current_node->next);
current_node = current_node->next;
}
fflush(stdin);
getchar();
}

2. Code:
```typedef <something> Distance;
typedef <something> Key;

Distance findDistance( Key k1, Key k2 )
{
Key k3;
Node *n1, *n2;

for( n1 = firstNode; n1 != NULL; n1 = n1->next )
{
if( n1->key == key1 ) break;
}
if( n1 == NULL )
{
return -1;
}

/*do the exact same thing for n2 */

/* compute the distance however you do, then return it */
return getDistance( n1, n2 );
}```
There is enough code/pseudo-code to get you through.

Quzah.