Hi,
I allocate some memory of size_t but want to express:
printf("Total amount of allocated memory is: %lu bytes.\n", (unsigned
long) total_mem);
in kilo-bytes. So is method 1 or 2, the correct one? I've seen both
explanations using google:
1)
printf("Total amount of allocated memory is: %lu kb.\n", (unsigned long)
total_mem/1024);
2)
printf("Total amount of allocated memory is: %lu kb.\n", (unsigned long)
total_mem/1000);
Best regards / Med venlig hilsen
Martin Jørgensen
--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
I allocate some memory of size_t but want to express:
printf("Total amount of allocated memory is: %lu bytes.\n", (unsigned
long) total_mem);
in kilo-bytes. So is method 1 or 2, the correct one? I've seen both
explanations using google:
1)
printf("Total amount of allocated memory is: %lu kb.\n", (unsigned long)
total_mem/1024);
2)
printf("Total amount of allocated memory is: %lu kb.\n", (unsigned long)
total_mem/1000);
Best regards / Med venlig hilsen
Martin Jørgensen
--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Comment