What is the correct format specifier for double in printf? Is it %f or is it %lf? I believe it's %f, but I am not sure.
Code sample
#include <stdio.h>
int main()
{
double d = 1.4;
printf("%lf", d); // …
#include <stdio.h>
int main() {
unsigned long long int num = 285212672; //FYI: fits in 29 bits
int normalInt = 5;
printf("My number is %d bytes wide and its value is %ul. A normal number is %d.\n", sizeof(num), num, normalInt);
…
I can never understand how to print unsigned long datatype in C.
Suppose unsigned_foo is an unsigned long, then I try:
printf("%lu\n", unsigned_foo)
printf("%du\n", unsigned_foo)
printf("%ud\n", unsigned_foo)
printf("%ll\n", …