Wrox Programmer Forums
|
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
 
Old January 6th, 2009, 08:59 AM
Authorized User
 
Join Date: Dec 2008
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
Default 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 !
 
Old February 23rd, 2009, 07:19 PM
Registered User
 
Join Date: Feb 2009
Posts: 3
Thanks: 0
Thanked 1 Time in 1 Post
Default

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:
phuc_tran (May 28th, 2009)
 
Old May 28th, 2009, 04:12 PM
Registered User
 
Join Date: May 2009
Posts: 5
Thanks: 0
Thanked 3 Times in 3 Posts
Default 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:
phuc_tran (May 28th, 2009)
 
Old May 29th, 2009, 12:40 PM
Authorized User
 
Join Date: Dec 2008
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
Default

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 ?
 
Old June 10th, 2009, 11:56 PM
Registered User
 
Join Date: May 2009
Posts: 5
Thanks: 0
Thanked 3 Times in 3 Posts
Default 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:
VC++ (June 12th, 2009)
 
Old June 12th, 2009, 04:45 PM
Registered User
 
Join Date: Jun 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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...
 
Old June 12th, 2009, 04:46 PM
Registered User
 
Join Date: Jun 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Sorryy..the last one was a spam





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use like operator thillaiarasu SQL Server 2000 4 April 23rd, 2010 09:47 AM
=== operator in c# surendraparashar C# 2005 8 November 8th, 2007 05:14 AM
Invalid operator for data type. Operator equals di Pusstiu SQL Server 2000 2 August 10th, 2007 04:51 AM
intersect operator kapy_kal XSLT 1 March 29th, 2006 02:02 PM
? operator in PHP Tachyon Beginning PHP 2 May 24th, 2004 02:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.