+ 2
Why the output of the program is "4, 4, 8, 1"???
#include <stdio.h> int main() { printf("int: %d \n", sizeof(int)); printf("float: %d \n", sizeof(float)); printf("double: %d \n", sizeof(double)); printf("char: %d \n", sizeof(char)); return 0; }
8 ответов
+ 2
Ok thank you bro
Niek Aukes
+ 1
Niek Aukes plz can you answer me in detail. Thank you😊
+ 1
Well, an int takes 4 bytes in the memory, double takes 8 bytes. Its measuring the size of the data. Mostly you won't use it much since current memory is at least more than a gigabyte
+ 1
Niek Aukes
As far as I know, int requires 2 bytes?
0
Int- 4 bytes
float - 4 bytes
double - 8 bytes
Char - 1 byte
If you were asking something else, leave a reply
0
Vaibhav I think you mean short ints, they require 2 bytes, but can't surpass the number 32768 since all bits are used
0
But if not mentioned,
sizeof(int) will give as 2
0
#include <stdio.h>
int main() {
printf("int: %d \n", sizeof(int));
printf("short: %d \n", sizeof(short));
return 0;
}
Int: 4
Short: 2
Vaibhav highly doubt it