Data Types
Sizeof
sizeof reports how many bytes a type or value uses on the current platform.
Sizeof
sizeof_types.c
#include <stdio.h>
int main(void) {
int count = ;
int bytes = (int)(count * sizeof(int));
printf("int=%zu\n", sizeof(int));
printf("bytes=%d\n", bytes);
return 0;
}
#include <stdio.h>
int main(void) {
int count = ;
int bytes = (int)(count * sizeof(int));
printf("int=%zu\n", sizeof(int));
printf("bytes=%d\n", bytes);
return 0;
}
#include <stdio.h>
int main(void) {
int count = ;
int bytes = (int)(count * sizeof(int));
printf("int=%zu\n", sizeof(int));
printf("bytes=%d\n", bytes);
return 0;
}
sizeof
`sizeof(int)` returns the byte count for one `int`.
byte count
Multiplying by a count estimates how many bytes a sequence of values needs.