which is faster ?++ or +

Discussion in 'C' started by priyanka.js28, Sep 5, 2010.

  1. priyanka.js28

    priyanka.js28 New Member

    Joined:
    Sep 5, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    which one of the following will execute faster?
    int p=2;
    p++; OR p=p+1;OR p+=1;


    and y??
    is it p++ bcoz it is a single instruction??...nd the rest r multiple...
     
  2. techgeek.in

    techgeek.in New Member

    Joined:
    Dec 20, 2009
    Messages:
    572
    Likes Received:
    19
    Trophy Points:
    0
    Occupation:
    EOC (exploitation of computers)..i m a Terminator.
    Location:
    Not an alien!! for sure
    Home Page:
    http://www.techgeek.in
    yes, from microprocessor point of view short instructions are likely to execute faster but if the instructions is expanded to the actual form and then converted to assembly code then I think there will not be any diff in the execution...
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice