Printing unsigned long long int Value Type Returns Strange Results

前端 未结 4 678
野的像风
野的像风 2021-01-17 13:45

I have a problem while using the printf function to print values of type unsigned long long int

I have no idea what\'s wrong. I\'m using De

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-17 14:10

    You are not passing unsigned long longs. You are passing an int (0) and unsigned long (ULONG_MAX). You must pass to printf() exactly what you promise to pass in the format string.

    Try this instead:

    printf("unsigned long long int: \n%llu to %llu \n\n", 0ULL, (unsigned long long)ULONG_MAX);
    

提交回复
热议问题