Listing 3 Tests the Date type

/* tdate.c */
#include <stdio.h>
#include "date.h"

#define DATELEN 19

main()
{
   Date d1 = {10,1,1951}, d2 = {3,7,1995};
   char buf[DATELEN+1];
   int cmp;

   printf("dl == %s\n",date_format(&d1,buf));
   printf("d2 == %s\n",date_format(&d2,buf));
   cmp = date_compare(&d1,&d2);
   printf("d1 %s d2\n",
         (cmp < 0) ? "precedes"
                 : (cmp > 0) ? "follows"
                 : "equals");
   return 0;
}

/* Output:
d1 == October 1, 1951
d2 == March 7, 1995
d1 precedes d2
*/

/* End of File */