HI,

in my assignment the requierment for the functions are
[PHP
read_list function
This function receives a pointer to an empty list. It creates a list with input STUDENT records given by the user. The input is terminated when a record with a negative student number is given. This last record itself is not stored in the list.

output_list function
This function receives a list pointer and displays the records as follows: 1 record per row. The output should have a header (Student No. Student Name GPA) and should be well formatted.
[/PHP]

I made the function but it is not working properly it takes the input and then only prints the last element in the list. I have been trying to figure out the problem for hours and i can;t seem to figure out, i some could please help me that will be higly appreciated.

PHP Code:
#include <stdio.h>
#include <string.h>


typedef struct {
float GPA;
char LastName[20];
unsigned int StudentNumber;

}
STUDENT;


typedef struct{
    
STUDENT aStudent;
    
struct NODE next
}
NODE;


void read_list(NODE pList){
int userStudentNumber =0;
NODE temp;
temp pList;

while(
userStudentNumber >=0)
{
    
printf("Please Input Students StudentNumber\n"); 
    
scanf("%d",&userStudentNumber);
    if(
pList==NULL)
    {  if(!(
pList = (NODE*) malloc(sizeof(NODE)))){

         exit(
100);
        }
    
        
temp pList;
    }
    else
    {
        while((
temp->next)!=NULL)
        {

            
temp=temp->next;

        }
        
        
temp->next malloc(sizeof(NODE));
        
temp=temp->next;
}
temp->aStudent.StudentNumber userStudentNumber;
temp->next  NULL;

}
temp->next  NULL;
}

void output_list(NODE pList){
while(
pList!=NULL)
{

    
printf(" Data : %d",pList->aStudent.StudentNumber);
    
printf(" Link : %d",pList->next);
    
pList=pList->next;
}

}


int main(void){
NODE head NULL;
head read_list(head);
output_list(head);

return 
0;

Thanks,
Kim