Sounds like you need an fgets/sscanf pair and a linked list:
Code:
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
char name[100];
int number;
struct node *next;
} *link;
int main ( ) {
char buffer[BUFSIZ];
link list;
link scratch;
list = 0;
while (fgets(buffer, sizeof buffer, stdin) != NULL) {
if ((scratch = malloc(sizeof *scratch)) == NULL)
break;
if (sscanf(buffer, "%s%d", scratch->name, &scratch->number) != 2)
break;
scratch->next = list;
list = scratch;
}
for (scratch = list; scratch != NULL; scratch = scratch->next)
printf("%s -- %d\n", scratch->name, scratch->number);
return 0;
}