 |
BOOK: Ivor Horton's Beginning Visual C++ 2008 ISBN: 978-0-470-22590-5
 | This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2008 by Ivor Horton; ISBN: 9780470225905 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2008 ISBN: 978-0-470-22590-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 6th, 2009, 08:59 AM
|
|
Authorized User
|
|
Join Date: Dec 2008
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Comma Operator
At the page of 73 & 74 , I've read something about the comma operator . But I don't know in which case , this operator is used . Please help ! 
|
|

February 23rd, 2009, 07:19 PM
|
|
Registered User
|
|
Join Date: Feb 2009
Posts: 3
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi. The comma operator is used in declarations:
int a, c, d;
int e=4, f=5, g=6;
|
|
The Following User Says Thank You to ArtlessDodger For This Useful Post:
|
|
|

May 28th, 2009, 04:12 PM
|
|
Registered User
|
|
Join Date: May 2009
Posts: 5
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Comma Operator
The comma operator is also used to seperate expressions. It appears frequently in the for statement. Example:
for (i = 0, j = strlen(s) - 1; i < j; i++, j--)
Ken
Last edited by KenStewart; May 28th, 2009 at 04:21 PM..
|
|
The Following User Says Thank You to KenStewart For This Useful Post:
|
|
|

May 29th, 2009, 12:40 PM
|
|
Authorized User
|
|
Join Date: Dec 2008
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Thanks for your replies , I've known the functions of comma operator which you mentioned . But I mean , beside these functions , does comma operator have other special functions ?
|
|

June 10th, 2009, 11:56 PM
|
|
Registered User
|
|
Join Date: May 2009
Posts: 5
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Comma Operator
phuc_tran,
While searching for something else, I stumbled across this tid-bit in an on-line book available from Microsoft MSDN called "C++ A Beginners Guide" by Herbert Schildt. It is something I would normally read right past without even noticing. However I remembered your question so I spent a little time looking at it. The following is copied directly from Chapter 7 page 31.
var = (count=19, incr=10, count+1);
"first assigns count the value 19, assigns incr the value 10, then adds 1 to count, and finally assigns var the value produced by the entire comma expression, which is 20."
I'm guessing the assignment of 20 to var is because this operation was the very last to be performed in the series of operations.
Ken
|
|
The Following User Says Thank You to KenStewart For This Useful Post:
|
|
|

June 12th, 2009, 04:45 PM
|
|
Registered User
|
|
Join Date: Jun 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
YO!
What's ur real name...I can'rt talk to zombies...are u a professional...we can develop sth together..moreover, i do not belive that declarations use comma operators........ya..so coem out with real name...
|
|

June 12th, 2009, 04:46 PM
|
|
Registered User
|
|
Join Date: Jun 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Sorryy..the last one was a spam 
|
|
 |