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 longwith%lldspecifier viascanf()if your compiler and standard library supports that, but it is not guaranteed to be 64bit. (long longcan 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_ttype and"%" SCNd64format specifier frominttypes.hif it is supported in your environment.int64_tis a signed integer type with exactly 64bit. You can useuint64_ttype and"%" SCNu64format specifier for unsigned 64-bit integer.Example: