clong-integerunsignedunsigned-long-long-int

Two -Wformat warnings (unknown conversion type & too many arguments for format)


#include <stdio.h>

int main()
{
    unsigned long long int the_num = 600851475143;
    
    printf("%llu", the_num);

    return 0;
}

When I try to compile this, I get the following warnings:

3.c: In function 'main':
3.c:10:12: warning: unknown conversion type character 'l' in format [-Wformat=]
  printf("%llu", the_num);
            ^
3.c:10:9: warning: too many arguments for format [-Wformat-extra-args]
  printf("%llu", the_num);
         ^~~~~~

Maybe it's just a bug or something?..

GCC version:

gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)

Compiled using the following command:

gcc -Wall -Wextra -pedantic 3.c


Solution

  • I changed the language standard to c99 by adding -std=c99 flag while compiling and the warnings disappeared.