Bonsoir,
Je voulais savoir s'il ya une fonction standard de C qui converti un entier en une chaine de caractere
Merci
Bonsoir,
Je voulais savoir s'il ya une fonction standard de C qui converti un entier en une chaine de caractere
Merci
Oui, sprintf().Envoyé par chmaichel
http://man.developpez.com/
![]()
En gros, ça s'utilise comme fprintf, mais tu passes une chaîne de caractère en premier paramètre:
Thierry
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 #include <stdio.h> #include <stdlib.h> int main(void) { char mon_entier[10]; sprintf(mon_entier, "%d", 2007); printf("Mon entier est %s!\n", mon_entier); return EXIT_SUCCESS; }
"The most important thing in the kitchen is the waste paper basket and it needs to be centrally located.", Donald Knuth
"If the only tool you have is a hammer, every problem looks like a nail.", probably Abraham Maslow
FAQ-Python FAQ-C FAQ-C++
+
Partager