delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/01/09:28:25

From: "Jason News" <hello AT mymail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Que on C
Date: Mon, 1 Nov 1999 19:54:22 +0800
Organization: netteens.net (Hongkong Telecom IMS)
Lines: 57
Message-ID: <7vjv87$32f$1@imsp026.netvigator.com>
NNTP-Posting-Host: olkc10a130.netvigator.com
Mime-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

This is a multi-part message in MIME format.

------=_NextPart_000_0018_01BF24A2.E43E6720
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi everyone,
can anyone tells me why
int x=3D5, y=3D5;
printf ("1st %d, 2nd %d\n" ++x, y++");

will show 1st 6, 2nd 5

int x=3D5
prinf ("1st %d, 2nd %d\n" ++x, x++");

will show 1st 7, 2nd 5

What I don't understand is that the increament of ++x is 1. Then why the =
latter one will show 7, the one with increament value 2?

------=_NextPart_000_0018_01BF24A2.E43E6720
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi everyone,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>can anyone tells me why</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>int x=3D5, y=3D5;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>printf ("1st %d, 2nd %d\n" ++x, =
y++");</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>will show 1st 6, 2nd 5</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>int x=3D5</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>prinf ("1st %d, 2nd %d\n" ++x, =
x++");</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>will show 1st 7, 2nd 5</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>What I don't understand is that the =
increament of=20
++x is 1. Then why the latter one will show 7, the one with increament =
value=20
2?</FONT></DIV></BODY></HTML>

------=_NextPart_000_0018_01BF24A2.E43E6720--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019