Calculating cumulative constants (was Re: need "yy-ddd-hh:mm:ss ...)

Dave P. Schaumann dave at cs.arizona.edu
Thu Feb 28 07:24:45 AEST 1991


In article <1991Feb27.013021.5178 at cc.helsinki.fi> wirzenius at 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 at 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



More information about the Comp.lang.c mailing list