jdhao's digital space

Recent content on jdhao's digital space

马上订阅 jdhao's digital space RSS 更新: https://jdhao.github.io/index.xml

Remainder Operator(%) in C++

2017年10月7日 21:11

What is value of a and b in the following statement according to the rules of C++ 11?

int a = -5 % 2;
int b = 5 % -2;

If you can not clearly tell the result, then you should update your knowledge about % operator in C++.