I'm trying to get cs50 IDE to print the size of char
, double
, float
and int
. This is what I wrote:
#include <stdio.h>
int main(void)
{
char c;
double d;
float f;
int i;
printf("char: %i\n", sizeof(c));
printf("double: %i\n", sizeof(d));
printf("float: %i\n", sizeof(f));
printf("int: %i\n", sizeof(i));
}
This is the error message:
sizeof.c:11:26: error: format specifies type 'int' but the argument has type 'unsigned long' [-Werror,-Wformat] printf("char: %i\n", sizeof(c));
why doesnt it work? I've also tried with %d