Thread: p++ and ++p

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    278
    A more detailed explanation is that with ++p, the value of p is incremented BEFORE the expression it is part of. with p++, the value of p is incremented AFTER the expression it is part of. With both of them, the value of p is the same both before and after the expression has been evaluated.

  2. #2
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312
    A nice article about ++p in for() loops in the FAQ: Cprogramming.com - C/C++ Programming Tips and Tricks
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

Popular pages Recent additions subscribe to a feed