Create a Structure to record date - C Structure

C examples for Structure:Structure Definition

Description

Create a Structure to record date

Demo Code


#include <stdio.h>

int main (void)
{
    struct date/*from  w ww .  ja va2 s .c o  m*/
    {
        int month;
        int day;
        int year;
    };

    struct date today;

    today.month = 9;
    today.day = 25;
    today.year = 2019;

    printf ("Today's date is %i/%i/%.2i.\n", today.month, today.day, today.year % 100);
    return 0;
}

Result


Related Tutorials