Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main() {
- typedef
- struct fv {
- char name[20];
- size_t sz;
- } fv;
- fv types[] = {
- { "char", sizeof(char), },
- { "short", sizeof(short), },
- { "int", sizeof(int), },
- { "long", sizeof(long), },
- { "long long", sizeof(long long), },
- { "float", sizeof(float), },
- { "double", sizeof(double), },
- { "long double", sizeof(long double), },
- };
- size_t types_s = sizeof(types);
- size_t types_e = types_s / sizeof(*types);
- for (size_t e_ = 0; e_ < types_e; ++e_) {
- char * name = types[e_].name;
- size_t size = types[e_].sz;
- printf("size of %16s %2zu\n", name, size);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement