you should change char* to char, right now numberstring is an array of pointers – josefx Jun 1 '12 at 9:10.
A char in C is already a number (the character's ASCII code), no conversion required.
@kevin001 If you want to convert the char to int and a character '1' provides a ascii number that's not 1, you need to remove the offset '0' to realign it to count from 0-9.
int a = 65; char c = (char) a; Note that since characters are smaller in size than integer, this casting may cause a loss of data.
EDIT: As pointed out in the comment, itoa() is not a standard, so better use sprintf() approach suggested in the rivaling answer! You can use itoa() function to convert your integer value to a string.
I have a char that is given from fgets, and I would like to know how I can convert it into a char*. I am sure this has been posted before, but I couldn't find one that was doing quite what I wanted to do.
int a = '1'; char b = (char) a; System.out.println(b); will print out the char with ascii value 49 (one corresponding to '1'). Java Convert int to char - javatpoint. www.javatpoint.com. We can convert int to char in java using typecasting.
nqoc and 7457=convert(int,(select char(113)+char(107)+char(98)... www.oyunlaroyunlar2.com.
Actually, it doesn’t convert the datatype of <char> (assuming it’s a variable), although the result of the expression will be an [code ]int[/code].
string[0] = (char) num; I'm working my way through a larger program to figure out what it does