Can I take 64 bit numbers input in C with %lld?
If not how to? Please give an example when you answer.
Thank you
Can I take 64 bit numbers input in C with %lld?
If not how to? Please give an example when you answer.
Thank you
Copyright © 2021 Jogjafile Inc.
You can read integers of
long long
with%lld
specifier viascanf()
if your compiler and standard library supports that, but it is not guaranteed to be 64bit. (long long
can store at least numbers between-9223372036854775807
(-(2**63 - 1)
) and+9223372036854775807
(2**63 - 1
) (both inclusive), so it should be at least 64bit)You can use
int64_t
type and"%" SCNd64
format specifier frominttypes.h
if it is supported in your environment.int64_t
is a signed integer type with exactly 64bit. You can useuint64_t
type and"%" SCNu64
format specifier for unsigned 64-bit integer.Example: