0

How it shows "int : 4".... there is nothing mentioned like "4"...

#include <stdio.h> int main() { printf("int: %ld \n", sizeof(int)); printf("float: %ld \n", sizeof(float)); printf("double: %ld \n", sizeof(double)); printf("char: %ld \n", sizeof(char)); return 0; }

31st Mar 2021, 2:14 AM
S M Rakibul Alam
S M Rakibul Alam - avatar
4 Answers
+ 4
The sizeof method returns the amount of memory allocated to a data type or an expression. The value for the same data type is different for 32 - bit and 64 - bit machines. The memory allocated to different data types in C is given below, int - 4 bytes float - 4 bytes double - 8 bytes char - 1 byte
31st Mar 2021, 2:51 AM
Soumik
Soumik - avatar
+ 1
It means in C Program,,, for each integer needs 4 bytes.... Am I right....Mr. Soumik?
31st Mar 2021, 2:54 AM
S M Rakibul Alam
S M Rakibul Alam - avatar
+ 1
Yes S.M. Rakibul Alam and I'm not a Mr.
31st Mar 2021, 3:11 AM
Soumik
Soumik - avatar
0
Ok,,😅 Thank you.
31st Mar 2021, 3:12 AM
S M Rakibul Alam
S M Rakibul Alam - avatar