0
Convert integer in a char array
I want to put an integer (that can start in 0) and print it like it was a char. Just using the función write in c language.
3 Respostas
0
For example?
Can you give an example to understand it clearly...?
You mean
Input 1 (int)
Output 1 (char)?
It is better to give a try and post your tried code if it is incomplete?
0
You can use sprintf():
int number = 1353;
ch_array[] = "hi";
sprintf(ch_array, "%d", number);
printf("%d\n", number);
printf("%s\n",ch_array);
//output :
1353 // number as int
1353 // number as char array