I declared and initialized two char arrays in two ways :
char array_1 [10] = "012345"; 
char* array_2 = Array_Initializer();
The array_initializer is as follows: (I deleted some part that I'm sure irrelevant)
char* Array_Initializer(){
   string return_array = "012345";
   return const_cast<char*> (return_array.c_str());
}
And when I do cout<< array_1<< endl;  and cout<< array_2<< endl; Both will output "012345" correctly.
But the problem comes when I pass them into a function that takes char* arg as and argument. The function will only get array_1 correctly, but will get a undefined value when I pass in array_2. Can anyone tell me why?  
PS: my sample function looks funny but I only kept what I think relevant :)
 
    