That is no variables should be involved in the

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: t int int } struct date birthday = {5, 12, 91} The initial values should be constant values or constant expressions. That is, no variables should be involved in the initializer expressions. For automatic struct variables, if fewer initializers are listed than the number of members in the struct, values of the remaining members are unde ned. CSC 1500 { Lecture 11 10 The Use of typedef and struct #include <stdio.h> struct date { int day int month int year } typedef struct date date_t int main(void) { date_t int today, dob age printf("Date of birth (dd mm yy)? ") scanf("%d %d %d", &, &dob.month, &dob.year) printf("Today (dd mm yy)? ") scanf("%d %d %d", &, &today.month, &today.year) if (today.month > dob.month || (today.month == dob.month && >...
View Full Document

This note was uploaded on 05/23/2010 for the course COMPUTER S CSC1500 taught by Professor Fung during the Spring '10 term at CUHK.

Ask a homework question - tutors are online