ARRAYS WITH IN STRUCTURES

ARRAYS WITH IN STRUCTURES:
           
            C permits the use of arrays as structure members.
                        struct marks
                           {
                                    int stno;
                                    float sub[3];
                            };
                        struct marks  student [10];

here the member sub contains three elements sub[0], sub[1] and sub[2]. These elements can be accessed using appropriate subscripts. For example
                        student[1] . sub[2];
would refer to the marks obtained in the third subject by the second student.

No comments:

Post a Comment