Why this code is not working?
#include <stdio.h>
main()
{
UINT64_t ram = 90;
printf("%d""\n", ram);
}
I got the Following errors:
In function \u2018main\u2019
error: \u2018UINT64_t\u2019 undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: for each function it appears in.)
error: expected \u2018;\u2019 before \u2018ram\u2019
uint64_t
is defined in Standard Integer Type header file. ie, stdint.h
.
So first include stdint.h
in your program.
Then you can use format specifier "%"PRIu64
to print your value: i.e.
printf("%" PRIu64 "\n", ram);
You can refer this question also How to print a int64_t type in C
Full working example: http://ideone.com/ttjEOB
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
int main()
{
uint64_t ram = 90;
printf("%" PRIu64 "\n", ram);
}
You forgot some headers, wrote incorrectly uint64_t
and can't use %d
with uint64_t
Add:
#include <inttypes.h>
And use PRIu64 (outside of quotation marks like so):
printf("%"PRIu64"\n", ram);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With