/* This is the thirteenth lab of Lab EE107
The purpose of this lab to illustrate structure that consist of array.

Creating the code and free of syntax and grammatical errors.
Author: Ekwegbalum Unachukwu
Star ID:do2170dt
Date: April 23rd, 2024.
*/


#include <stdio.h>

// Structure definition for month
struct month_EU
{
    int numberOfDays_EU;
    char name_EU[3];
};

int main(void)
{
    // Declaration of variables
    int i;
    struct month_EU
    {
        int numberOfDays_EU;
        char name_EU[3];
    };

    // Array of structures for months
    const struct month_EU months_EU[12] =
    {
        {31, {'J', 'a', 'n'}}, {28, {'F', 'e', 'b'}}, {31, {'M', 'a', 'r'}},
        {30, {'A', 'p', 'r'}}, {31, {'M', 'a', 'y'}}, {30, {'J', 'u', 'n'}},
        {31, {'J', 'u', 'l'}}, {31, {'A', 'u', 'g'}}, {30, {'S', 'e', 'p'}},
        {31, {'O', 'c', 't'}}, {30, {'N', 'o', 'v'}}, {31, {'D', 'e', 'c'}}
    };

    // Print month number of days
    printf("Month Number of Days\n");
    printf("--------------------\n");
    for (i = 0; i < 12; ++i)
    {
        printf("%c%c%c %i\n", months_EU[i].name_EU[0], months_EU[i].name_EU[1],
               months_EU[i].name_EU[2], months_EU[i].numberOfDays_EU);
    }

    // Return 0 to indicate successful execution
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: