W
wenmang
what is format for sprintf to convert long long integer (64 bits) to
string?
string?
what is format for sprintf to convert long long integer (64 bits) to
string?
You could look it up? If int is %d and long is %ld could it be %lld ?what is format for sprintf to convert long long integer (64 bits) to
string?
Måns Rullgård said:The format for "long long" is %lld (or %llx etc.). Keep in mind
though, that a long long is not necessarily 64 bits. If you
specifically need 64 bits, use the types defined in stdint.h and the
format macros in inttypes.h.
Hmm, and since %f is used to printf() a double, I can use %f to scanf() aJoe said:You could look it up? If int is %d and long is %ld could it be %lld ?
Just guessing. I haven't looked it up.
Skarmander said:Hmm, and since %f is used to printf() a double, I can use %f to
scanf() a double, right?
You're ruining my fun.Måns Rullgård said:Wrong. With scanf %f denotes a float, and %lf denotes a double. This
difference is because the arguments to printf are subject to type
promotion, so any float arguments are converted to double. The
arguments to scanf are pointers, so there is a need to differentiate
between pointer to float and pointer to double.
Måns Rullgård said:The format for "long long" is %lld (or %llx etc.). Keep in mind
though, that a long long is not necessarily 64 bits.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.