Still doesn't work, but maybe with this it's clearer what I'm trying to accomplish:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef struct
{
int id;
int birthyear;
int height;
int weight;
int salary;
char* firstname;
char* lastname;
} Person;
int main( )
{
int i ,temp;
Person data[99];
while(getchar() != '\n')
{
scanf("%d %d %d %d %s %s", &data[temp].birthyear , &data[temp].height , &data[temp].weight , &data[temp].salary , &data[temp].lastname , &data[temp].firstname);
data[temp].id = temp;
}
for(i=0; i<99;i++)
{
if(data[i].firstname != NULL)
printf("%d %d %d %d %s %s",data[i].birthyear ,data[i].height ,data[i].weight ,data[i].salary ,data[i].lastname ,data[i].firstname);
}
}
the while loop should be something like while((temp = getchar()) != NULL) but that wouldn't compile, since its a comparison between a pointer and an int
Edit: Stupid realization: it should be EOF, I blanked out before on what it should be, woops. the program compiles now but it still crashes on running.