For a string text,
why isn't
for(i = 0; strlen = n, i < n; i++)
text[i] = (int) text[i]
casting each character of text as an integer?
Printable View
For a string text,
why isn't
for(i = 0; strlen = n, i < n; i++)
text[i] = (int) text[i]
casting each character of text as an integer?
Presumably text is an array of chars, so of course it remains an array of chars. Perhaps you want to copy over each char in text to an int in an array of ints.
How do I do that?
Code:int nums[10];
char str[10];
for ( int i = 0; i < 10; ++i )
{
nums[i] = str[i];
}
don't forget the (int) cast