0

ULLONG_MAX from limits.h isn't working

This works on sololearn: printf("LLONG_MAX = %lld", LLONG_MAX); But this doesn't work: printf("ULLONG_MAX = %llu", ULLONG_MAX); why? [EDIT] Ok, let me be more specific here... Try this with and without commenting the last printf: #include <stdio.h> #include <limits.h> int main() { printf("\n========================================\n"); printf("Signed Integer Types"); printf("\n========================================\n"); printf("\nsigned char\n\n"); printf("SCHAR_MIN = %+hhd\n", SCHAR_MIN); printf("SCHAR_MAX = %+hhd\n", SCHAR_MAX); printf("\nsigned short int\n\n"); printf("SHRT_MIN = %+hd\n", SHRT_MIN); printf("SHRT_MAX = %+hd\n", SHRT_MAX); printf("\nsigned int\n\n"); printf("INT_MIN = %+d\n", INT_MIN); printf("INT_MAX = %+d\n", INT_MAX); printf("\nsigned long int\n\n"); printf("LONG_MIN = %+ld\n", LONG_MIN); printf("LONG_MAX = %+ld\n", LONG_MAX); printf("\nsigned long long int\n\n"); printf("LLONG_MIN = %+lld\n", LLONG_MIN); printf("LLONG_MAX = %lld\n", LLONG_MAX); printf("\n========================================\n"); printf("Unsigned Integer Types"); printf("\n========================================\n"); printf("\nunsigned char\n\n"); printf("UCHAR_MAX = %hhu\n", UCHAR_MAX); printf("\nunsigned short int\n\n"); printf("USHRT_MAX = %hu\n", USHRT_MAX); printf("\nunsigned int\n\n"); printf("UINT_MAX = %u\n", UINT_MAX); printf("\nunsigned long int\n\n"); printf("ULONG_MAX = %lu\n", ULONG_MAX); printf("\nunsigned long long int\n\n"); printf("ULLONG_MAX = %llu\n", ULLONG_MAX); return 0; } why does the last printf result in compilation error?

5th Oct 2018, 5:43 AM
Lucas Jadilo
Lucas Jadilo - avatar
1 ответ
+ 4
It perfectly works. #include <stdio.h> #include <limits.h> int main() { printf("LLONG_MAX = %lld\n", LLONG_MAX); // 92233... printf("ULLONG_MAX = %llu", ULLONG_MAX); // 18446... }
5th Oct 2018, 6:16 AM
Babak
Babak - avatar