My final goal is to initialize X.fmt with sprintf. My first solution is only to modify the fmt attribute but it didn't worked. Then I set the parameter to struct student_t &X in order to update the struct but it didn't worked either.
Here is my first solution:
char* fmt_str ( struct student_t X )
{
char *buf;
sprintf( buf, "%s|%s|%.2f",
X.id,
X.name,
X.gpa );
return (buf);
}
I need help to find the correct solution to modify the fmt attribute. But a solution that update the struct is also accepted.