@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.
This question already has answers here: Converting int to char in C (7 answers).
I know that for cannot convert char to char * you just use the & in front of the char, but I cannot figure out what to do in this case.
How can i convert an int below 10 to a char for example : 5 -> '5' (convert int to char without using ASCII table).
This is to convert from char pointer into char. I followed the codes from another topic but it seems like it's not working to me. I am using Open VMS Ansi C compiler for this.
Also as Shar1er80 points out you're currently converting the digit to the char that has the same ASCII value, and not the the actual characters that represent the digit. The digits 0-9 are represented by the the values 48-57. You can change the call to Random.Next to be: int num = randem.Next(48, 58)...
cast a '[not] char' to a 'char'. An actual operation with/on the dereferenced value behaves slightly differently between other unsigned/signed types, but in the case of 'char'/'unsigned char' it should be the same because the sign is just the msb of...
SELECT 'c'::char = 'c'::char AS true. Convert int to char in java - Stack Overflow.
int main(void). { /* with array/string literals at initialization, the sizes are technically unnecessary.
C# doesn’t support implicit conversion from type ‘int’ to ‘char’ since the conversion is type unsafe and risks potential data loss.