0

I am trying to do a student grade management project.

I am trying to define a variable type student of structure type using typedef

typedef struct info
{
    int rno;
    char name[40];
    char section[5];
    struct subdetail
    {
        char title[60];
        int code;
        int marks;
    } subject[6];
    
    double avg;
    double grade;
} student;

student s; // a variable s of student type

Now I want to assign values to title and code of 6 subjects in subject(structure).

I tried by s.subject[0].title[] = "Mathematics"; and s.subject[0].code = 1234;

This shows compilation error. How to fix it?

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621

0 Answers0