A structure type is defined as:
typedef struct student{
int id;
char* name;
double score;
} Student;
I construct a variable of type Student and I want to assign values to it. How can I do that efficiently?
int main(){
Student s1;
int id = 3;
char* name = getName(id);
double score = getScore(id);
/*Error
s1 = {id, name, score};
*/
/* Can I avoid assigning values individually?
s1->id = id;
s1->name = name;
s1->score= score;
*/
return 0;
}