[comp.lang.c] Calculating cumulative constants

dave@cs.arizona.edu (Dave P. Schaumann) (02/28/91)

In article <1991Feb27.013021.5178@cc.helsinki.fi> wirzenius@cc.helsinki.fi (Lars Wirzenius) writes:
|int cumulative_yday[] = {
|	0,			/* days before Jan 1st */
|	0+31,			/* Feb 1st */
|	0+31+28,		/* March 1st */
|	0+31+28+31,		/* April 1st */
|	...
|};

How about

enum { jan = 0, feb = jan+31, mar=feb+28, ... , dec=nov+30 } cum_days ;

int cumulative_yday[] = { jan, feb, mar, ..., dec } ;

-- 
		Dave Schaumann		dave@cs.arizona.edu
'Dog Gang'!  Where do they get off calling us the 'Dog Gang'?  I'm beginning to
think the party's over.  I'm beginning to think maybe we don't need a dog.  Or
maybe we need a *new* dog.  Or maybe we need a *cat*! - Amazing Stories