Is 1 byte 1 integer? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is 1 byte 1 integer?

14th May 2017, 2:27 PM
Kyroh
Kyroh - avatar
6 Answers
+ 4
1 Byte can at max represent a number from a range of 0-255... So It cannot represent an integer as C++ offers you a range of 0-65535...
14th May 2017, 4:52 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 3
printf("sizeof(int): %d bytes", (int) sizeof(int)); // run it
14th May 2017, 2:37 PM
Calviղ
Calviղ - avatar
+ 3
no 1 integer = 4 bytes c++ program to check bytes. int val=7; cout<<sizeof(val);
14th May 2017, 3:01 PM
MR Programmer
MR Programmer - avatar
+ 1
1 integer takes 2 bytes while 1 floating point Number takes 4 bytes
27th May 2017, 7:53 AM
Anweshan Bor
Anweshan Bor - avatar
0
why would you want it to take more bytes?
28th May 2017, 2:37 AM
Kyroh
Kyroh - avatar
- 2
1 integer 2 bytes
16th May 2017, 1:42 PM
bubblygiggles