There is a code:

unsigned long x = 0; printf("x = %d\n"); 

The compiler shows a warning:

example.cc:139:35: предупреждение: format «%d» expects argument of type «int», but argument 2 has type «long unsigned int» [-Wformat]

    1 answer 1

    You need the %lu specifier.

    printf - C ++ Reference