abhijit surwade wrote:

> what the difference between preincrement operator and
> post increment operator. i.e i++ and ++i

First off, when you start a new thread, send a new e-mail. Don't reply to an
existing thread. Bad 'netiquette.

Preincrement (++i) increments before the operation. Postincrement increments
after.

Probably the most famous use of the postincrement operator is from Kernighan
and Ritchie's book "The C Programming Language":

void strcpy (char *s, char *t)
{
        while (*s++ = *t++);
}

This copies a character from t to s, THEN increments s and t, THEN does the
boolean comparison. It's one of the most elegant pieces of C code I know.

Cordially,

Kerry Thompson




To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/c-prog/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to