Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) operator%=

 

operator%= is the operator to perform a modulus operation to a variable and assign the result to it.

 

#include <cassert>

int main()
{
  int x = 5;
  x%=3;
  assert(x == 2);
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict