Search This Blog

Friday, 14 June 2013

Evaluating expressions with side-effect

#include <iostream.h>

void main () {
  int i;

  i=1;
  cout << "Initial value of i = " << i 
    << ". The value of ++i is " << ++i 
      << ". Now i = " << i << endl;

  i=1;
  cout << "Initial value of i = " << i 
    << ". The value of i++ is " << i++ 
      << ". Now i = " << i << endl;
}

No comments:

Post a Comment