C/printf: Różnice pomiędzy wersjami
Usunięta treść Dodana treść
m →pierwszy: konwersja |
|||
Linia 182:
</source>
------->
====Konwersja ====
<source lang=c>
/*
gcc s.c -Wall
http://stackoverflow.com/questions/7228438/convert-double-float-to-string
*/
#include <stdio.h>
int main() {
size_t size = sizeof(double);
double d = 234.567;
char s[size]; // 16
snprintf(s, size, "%f", d); // convert double to string
printf(" d = %f = %s \n", d,s); // check
return 0;
}
</source>
====Liczby całkowite====
|