I am having a problem initializing an array of structs. I'm not sure if I am doing it right because I get "initialization from incompatible pointer type" & "assignment from incompatible pointer type". I added in the code where I get these warnings, and when I try to print the data from the struct I just get garbage such as @@###
typedef struct
{
char* firstName;
char* lastName;
int day;
int month;
int year;
} student;
// Initialize array
student** students = malloc(sizeof(student));
int x;
for(x = 0; x < numStudents; x++)
{
// Here I get: "assignment from incompatible pointer type"
students[x] = (struct student*)malloc(sizeof(student));
}
int arrayIndex = 0;
// Add struct
// Create student struct
// Here I get: "initialization from incompatible pointer type"
student* newStudent = {"john", "smith", 1, 12, 1983};
// Add it to the array
students[arrayIndex] = newStudent;
arrayIndex++;