I would like to create a sub routine for creating strings to full caps so I can create a menu feature that would be able to distinguish spelled words regardless of capitalization and possibly create small spell check features. Although I do not typically need a routine to specifically index arrays by the use of points to do this. I still can not figure out for the life of me how to pull a value from a pointer through a reference regardless how I cast or anything else.
I originated this task to perform to upper on a string to array conversion but once it was converted to a string it refused to be cast back to a char. Any ideas?
... does that compile ?? And if so, how did you do that ?
try the following ...
1 2 3 4 5 6
usingnamespace std;
string a;
char c_f[16] = " "; // I think char c_f[16] = {'\0'} would be fine here, but it should not matter ...
char * p = (char * ) &c_f[0]; // NOT char p = (char) &c_f[0];
That will do, i guess ...
The reason is you cast the address of c_f[0] (wich is a NOT a character) into a character.
So p, in case your compiler won't complain, will be a strange thing. And if you pick that value at the address "p" (which is a character in your code) .... well
I can't guess what p will be and i can not try it, because i can not compile the example. But with that little change it should work ... hopefully as intended.