struct student {
char name[30];
char rollNumber[20];
char class[2];
};
void test(int length){
struct student* tempStudent = (struct student*)malloc((length+1)*sizeof(struct student));
*tempStudent[0].name = "Hello";
printf("%s", *tempStudent[0].name);
}
void main(){
test(1);
}
When I try to run the above code, I get a warning "warning: assignment to 'char' from 'char *' makes integer from pointer without a cast" and the output as "(null)". What am I doing wrong?