TPU ChatChat on IRC
Internet Relay Chat?
Java Applet client
Who's on IRC?
Posted by manoj [send private reply] at June 13, 2002, 07:20:10 AM Hi guys, I'm back.
One can write statement like-
What I want to ask is what is the significance of using commas? Is it just that puts & buts case or is it there for some purpose ? I searched in ritchie, C FAQs, test your c skills, exploring C etc but could find anything other then the fact that only the last one is returned. They included it in ANSI C so I think something must be behind it. If none then these thing only make language more complex and unreadable beside adding a question in the FAQ books !!
Posted by rollic2002 [send private reply] at June 13, 2002, 08:13:51 AM we use commas to seperate statment from each other , i think it is just to make you source code neat and clear for you to understand it when you read it.
Posted by Psion [send private reply] at June 13, 2002, 09:34:56 AM The main place the comma operator is used is in loop conditions. For instance:
int i, j; for (i = 0, j = 1; i < 18; ++i, j += 18) puts("HIHIHIHI");
Posted by unknown_lamer [send private reply] at June 13, 2002, 10:58:15 AM , is the sequencing operator, meaning that each statement will occur after each the one before it. The value returned by the expression with the comma in it will be the value of the last statement, e.g.:
int foo = 15;
int bar =(foo /= 5, 2);
will make bar equal to 2 and foo equal to 3.
Posted by manoj [send private reply] at June 18, 2002, 03:56:05 AM Thanx,
I forgot about the for loop case. That foo/=5,2 is clear but it just makes the statement more confusing. I wonder why they kept in the ansi c!!
(I have to access net fro my college(15 minutes each student)
so I don't come here that frequently now,that's why this message has taken too long to be posted)
Posted by Psion [send private reply] at June 18, 2002, 07:36:11 AM That's a pretty gimpy college. You should transfer somewhere else just to get unlimited net access. =)
Posted by vikram_1982 [send private reply] at June 24, 2002, 02:36:34 AM Is Delhi Engineering that strict .... no unlimited net access.... omg.
Register as a new user