#include <stdio.h>

int main(void) 
    char c;
    double d;
    int i;
    float f;
    printf("char: %i", sizeof(c));

error: format specifies type 'int' but the argument has type 'unsigned long' [-Werror,-Wformat] printf("char: %i", sizeof(c));


You are telling to printf that you are going to print an int, while you actually want to print an unsigned long, since sizeof returns an unsigned long.

You should use %ul instead of %i.

You must log in to answer this question.

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