// increment_test.c - demonstration of increment 
// operator specialities

int first_number_ = 0;
int second_number_ = 0;

main()
{
  // post-increment without assignment
  first_number_++;
  printf("first_number_ after post-increment: %d\n",
          first_number_);

  // pre-increment without assignment
  ++first_number_;
  printf("first_number_ after pre-increment: %d\n",
          first_number_);

  // pre-increment with assignment
  second_number_ = ++first_number_;
  printf("second_number_ after pre-incr. assignment: %d\n",
          second_number_);

  // post-increment with assignment
  second_number_ = first_number_++;
  printf("second_number_ after post-incr. assignment: %d\n",
          second_number_);
  printf("but first_number_ now has the value: %d\n",
          first_number_);

  // this also works when used as a parameter!
  printf("first_number_ pre-incr. as parameter: %d\n",
          ++first_number_);
  printf("first_number_ post-incr. as parameter: %d\n",
          first_number_++);
  printf("but first_number_ now has the value: %d\n",
          first_number_);
}