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

Popular posts from this blog

python - How to add an model instance to a django queryset? -

Using Android Volley to post an array to PHP -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -