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

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -