#include <stdio.h>
int main() {
unsigned long long int num = 285212672; //FYI: fits in 29 bits
int normalInt = 5;
printf("%ul" is %d bytes; int value is %d.\n", num, sizeof(num), normalInt);
return 0;
}
Output: 285212672l is 8 bytes. int value is 0.
It's not supposed to be printed like that
normalInt
is being output strangely because "%ul" cannot hold all 285212672l ㅜㅜ
How do I print unsigned long int
?
Put l
for long
and ll
for long
To indicate unsigned
, attach u
.
printf("%llu", 285212672);
The devc++ program produces good results without errors.
© 2024 OneMinuteCode. All rights reserved.