Question: There are two issues in the following code snippet. Identify these issues, and fix them. struct student { char name[20]; int grade; }; struct student

There are two issues in the following code snippet. Identify these
issues, and fix them.
struct student {
char name[20];
int grade;
};
struct student * new_student(char * name, int grade) {
struct student * s = malloc(sizeof(*s));
s->name = name;
s->grade = grade;
return s;
}
int main() {
char name[20];
int grade;
scanf("%s %d", &name, &grade);
struct student * std = new_student(name, grade);
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!