Sizes of the Data Types

Easy

Print the size in bytes of each basic type using the sizeof operator, one type per line, in this order and format: char: 1, short: 2, int: 4, long: 8, float: 4, double: 8, long double: 16. The numbers must come from sizeof, not from typing them in, and they are printed with %lu after casting the result of sizeof to unsigned long, since C89 has no conversion specifier for size_t. The program reads no input.

Success Criteria

Your code must pass 1 test case(s) to complete this exercise. 3 hint(s) are available if you need help.

Sign in to track your progress

You can work on exercises as a guest, but sign in to track your progress and save your submissions.

This platform is built by its community

Every lesson, project, and tool on HelloC++ is funded by sponsors. Join them and help shape what we build next.

Become a Patron

How did you find this exercise?

Your rating helps us improve the content.