题解 | #KiKi定义电子日历类#
KiKi定义电子日历类
https://www.nowcoder.com/practice/e4c67097cdb242d9a3f38b7cfe839396
#include <stdio.h> typedef struct { int year; int month; int day; }TDate; void initDate(TDate* date) { date->year = 0; date->month = 0; date->day = 0; } void printDate(TDate* date) { printf("%d/%d/%d\n", date->day, date->month, date->year); } void setDate(TDate* date) { scanf("%d %d %d", &date->year, &date->month, &date->day); } int main() { TDate date; initDate(&date); setDate(&date); printDate(&date); return 0; }