Problem with strcpy function
I'm having a problem using the strcpy function. It works up to a certain point, and then I get this error message
"The variable src[i] has not yet been assigned a value.
It cannot be used until it has been initialized to something.
The error occurred while executing line 150:
The reason for the strcpy is to set a lowercase string to uppercase, without permanently changing it.
Any idea's how to solve this?
void PrintCityName( bool rightjustify ) const
if(rightjustify == true)
cout << setw(19) << ucity;
cout << city;
void PrintDest( ) const
cout << setw(4) << package_count << " packages weighing";
cout << setw(11) << fixed << setprecision(2)
<< total_weight << " pounds" << endl;
Last edited on
|The reason for the strcpy is to set a lowercase string to uppercase, without permanently changing it.|
Whatabout the toupper() function?
|"The variable src[i] has not yet been assigned a value.|
The message is clear. Initialize the source string.ie: give it a value beforr trying to copy from it.
CityNameType If it is typedef for char*, you need to allocate memory for it first.
Topic archived. No new replies allowed.