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?
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.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
How do I do that?
Code:int nums[10]; char str[10]; for ( int i = 0; i < 10; ++i ) { nums[i] = str[i]; }
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010
don't forget the (int) cast
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010