| delorie.com/archives/browse.cgi | search |
| From: | Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Initializing arrays problem |
| Date: | 22 May 2001 17:39:22 GMT |
| Organization: | Aachen University of Technology (RWTH) |
| Lines: | 21 |
| Message-ID: | <9ee88a$bgu$1@nets3.rz.RWTH-Aachen.DE> |
| References: | <20010522124331 DOT 00567 DOT 00000895 AT ng-mi1 DOT aol DOT com> |
| NNTP-Posting-Host: | acp3bf.physik.rwth-aachen.de |
| X-Trace: | nets3.rz.RWTH-Aachen.DE 990553162 11806 137.226.32.75 (22 May 2001 17:39:22 GMT) |
| X-Complaints-To: | abuse AT rwth-aachen DOT de |
| NNTP-Posting-Date: | 22 May 2001 17:39:22 GMT |
| Originator: | broeker@ |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
WCount12 <wcount12 AT aol DOT com> wrote:
> I am getting an error message "numeric constant contains digits beyond the
> radix" when initializing the below.
> int days_array = { 0101,0102,0103,0104 .........};
You've been hit by a feature of C, here: octal constants. Every integer
constant that begins with a '0' is interpreted as a number in the octal,
rather than the decimal system. I.e.
0101 == 8^2 * 1 + 8^0 * 1 = 64 + 1 = 65
not
0101 == 10^2 * 1 + 10^0 * 1 = 100 + 1 = 101
In octal constants, digits 8 and 9 are forbidden, thus the warning you
got.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |