c++11 - how does the below code output 3? (how does the below code read?) -
c++11 - how does the below code output 3? (how does the below code read?) -
the specific part not understand how -a in if statement changes -3 3. can explain how -a changes a = -3 a = 3?
#include <iostream> int main(){ signed = -3; if (a < 0){ std::cout << -a << std::endl; } else { std::cout << << std::endl; } system("pause"); homecoming 0; }
it's illustration of unary negative, when a=-3 (which less 0, code enters if block) -a -(-3) 3.
c++11 if-statement int signed
Comments
Post a Comment