Problem
I am using the GLib 2.0 library and declaring a gunit64 variable. I want to print its value for the screen, but it does not work properly.
the code
As an example, consider the following code snippet. I declare a guint64 variable and try to print its value.
guint64 myValue = 24324823479324;
printf("My Value: %d\n", myValue);
Attention
I get this warning:
warning: format β%dβ expects argument of type βintβ, but argument 2 has type βguint64β
Output
A strange negative number appears on the screen:
My value: -1871285220
Additional comments
I tried to search the API documentation and I found the following under guint64:
An unsigned integer guaranteed to be 64 bits on all platforms. Values ββof this type can range from 0 to G_MAXUINT64 (= 18,446,744,073,709,551,615).
, G_GINT64_MODIFIER / G_GUINT64_FORMAT.
, . , . - ?