Regarding Data Types

long signed CodingBlocks = 2017;

short unsigned BOSS1     = -2018;

unsigned BOSS2           = -2019;
int      BOSS3           = -2020;
long long unsigned BOSS4 = -2021;
short unsigned Nagarro   = 2018.9;
long signed HackerBlocks = 'A';
cout<<CodingBlocks<<endl;
cout<<BOSS1<<endl<<BOSS2<<endl<<BOSS3<<endl<<BOSS4<<endl;
cout<<Nagarro<<endl;
cout<<HackerBlocks<<endl;

Not understanding why that output came.

Hi,

  1. The value of CodingBlocks is same as expected as it lies in the range of long signed.

  2. 0<=short unsigned<=65535, if you give negative value then the actual value assigned to BOSS1 is like a cycle. Example: if BOSS1=65535 when we assigned -1 to it,65534 when we assigned -2 to it and so on.

  3. 0<=unsigned<= 4294967295, as explained above BOSS2=4294967295 when we assign -1 to it and so on.

4.As BOSS3 lies in the int range,so output is as expected.

5.0<=long long unsigned<=18446744073709551615. as explained above BOSS4=18446744073709551615 when -1 is assigned to it BOSS4=18446744073709551614 when -2 is assigned to it and so on.

  1. Since, short assigned round off the value to floor so output is 2018.

  2. Ascii value of ‘A’ is assigned to HackerBlocks.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.