Could anyone tell me what does this warning mean?
s_sort.c: In function 'main':
s_sort.c:15:15: warning: incompatible implicit declaration of built-in function
'malloc' [enabled by default]
A[i].name = malloc(MAXCHAR*sizeof(char));
I am trying to execute the following code. The platform is GCC 4.8.1 on Windows x64(TDM-GCC).
The problem is as far as I see in accessing structure members.
#include <stdio.h>
#define MAX 3
#define MAXCHAR 100
int main(){
struct STUDENT
{
int studentID;
char* name;
char grade;
} A[MAX];
int i;
printf("\n");
for (i=0;i<MAX;i++)
{
A[i].name = malloc(MAXCHAR*sizeof(char));
}
for (i=0;i<MAX;i++)
{
scanf("%d",&(A[i].studentID));
scanf("%s",A[i].name);
scanf("%c",&(A[i].grade));
}
printf("\n");
for (i=0;i<MAX;i++)
{
printf("%d ",A[i].studentID);
printf("%s ",A[i].name);
printf("%c ",A[i].grade);
printf("\n");
}
for (i=0;i<MAX;i++)
{
free(A[i].name);
}
}