Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Todd Carnes Newsgroups: comp.lang.c Subject: Re: what is the output Date: Tue, 5 Jul 2011 03:30:57 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 32 Message-ID: References: <6b2f8cbb-e8fc-45a2-b0dd-303418bc0234@r27g2000prr.googlegroups.com> NNTP-Posting-Host: uqlV+6kNo2Z0TnMsKGN6tA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Pan/0.133 (House of Butterflies) X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.lang.c:7634 On Sun, 03 Jul 2011 16:13:06 -0700, Chad wrote: > On Jul 3, 2:24 pm, Keith Thompson wrote: >> Chad writes: >> > On Jul 3, 10:47 am, Eric Sosman wrote: >> >> On 7/3/2011 12:32 PM, vinay kumar wrote: >> >> >> > main() >> >> > { >> >> > int d=010; >> >> > printf("%d",d); >> >> > } >> >> >> > please give with explanation >> [snip] > I got the number "8" after I compiled and ran this code on my Linux box > here at home. I just wasn't clear on why the computer produced the > number "8" and not the number "10". > > Chad Someone already told you that a leading zero is used to indicate that you are using the octal numbering system vice, the decimal system, correct? What does the octal number 010 equal in the decimal system? Hint: 010 in the binary system is equal to 2 in the decimal system. Todd