0
#include <cs50.h>
#include <stdio.h>

int main(void)
{
    printf("bool is %lu\n", sizeof(bool));
    printf("char is %lu\n", sizeof(char));
    printf("double is %lu\n", sizeof(double));
    printf("float is %lu\n", sizeof(float));
    printf("int is %lu\n", sizeof(int));
    printf("long long is %lu\n", sizeof(long long));
    printf("string is %lu\n", sizeof(string));
}

2 Answers 2

0

you are not printing float or double data type, but an integer type, keep in mind that %lu serves as support for the value returned by the sizeof () operator, which returns an integer number, the number of bytes it occupies in the memory a certain data type (float type for example)

0

The program isn't printing a certain thing from that data type, it's printing the the size of the data type, or how much space it takes on your computer. sizeof returns an unsigned long, so that's why there's a %lu.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .