A char in C is already a number (the character’s ASCII code), no conversion required.
If you want to convert a digit to the corresponding character, you can simply add ‘0’:
c = i +'0';
The ‘0’ is a character in the ASCll table.
More Related Contents:
- Not able to calculate in C.How do you calculate in C?
- C – Counting Numbers {making a program} [closed]
- How can I check if an element in an array is equal to something in C? [closed]
- Having a segmentation fault
- How can I get a text file into a string but whith the “\n” in C?
- Real-world use of X-Macros
- Check if input is integer type in C
- Adding leading underscores to assembly symbols with GCC on Win32?
- Why does this program print “forked!” 4 times?
- What does an assignment return?
- Print an int in binary representation using C
- Is C strongly typed?
- Creating a new directory in C
- POSIX API call to list all the pthreads running in a process
- Loop with function call faster than an empty loop
- C programming, why does this large array declaration produce a segmentation fault?
- Pointer Arithmetic: ++*ptr or *ptr++?
- Weird behavior when printing array in C?
- What’s the difference between static inline, extern inline and a normal inline function?
- How to check if a given file descriptor stored in a variable is still valid?
- Comparing float and double in C
- Convert char array to a int number in C
- Variable sized padding in printf
- Problems with SO_BINDTODEVICE Linux socket option
- close() is not closing socket properly
- Why is 248×248 the maximum bi dimensional array size I can declare?
- Using a Single system() Call to Execute Multiple Commands in C
- defining a 2D array with malloc and modifying it
- Why can’t a modifiable lvalue have an array type?
- functions returning char pointer