The walkthrough was filmed on the CS50 Appliance (which is a 32-bit machine). I assume you are trying to run the program using this year's CS50 IDE, which is a 64-bit machine. As such, the
sizeof() function will be returning
unsigned long values rather than
int values. You will need to change your print format from
%lu. I think the compile error actually says that as well.
Note that if you store the size values into
variables before printing, then you can print using
because you have implicitly cast the values to integers.
But, as the walkthrough code works,
printf("%lu", sizeof(long));, for example, requires the unsigned long print format.