Okay, let's start with a simpler example.
Code:
#include <stdio.h>
void GetAirplaneType(char **dest)
{
printf("print of the pointer value inside the function: %s %p\n", *dest, (void*)(*dest));
char new_dest[] = "Big Deal";
*dest = new_dest;
}
int main()
{
// Let's start with an array, not a const char*.
char des[100] = "New York";
printf("print of the pointer value outside the function: %s %p\n", des, (void*)des);
// Create a pointer that is pointing to the variable des.
char *n_des = des;
GetAirplaneType(&n_des);
printf("print of the pointer value outside the function: %s %p\n", n_des, (void*)n_des);
}
Note: You probably shouldn't be playing with pointers but instead copy the C-strings.
Code:
#include <stdio.h>
#include <string.h>
void GetAirplaneType(char *dest)
{
strcpy(dest, "Big Deal");
}
int main()
{
char des[100] = "New York";
printf("print of the pointer value before the function: %s \n", des);
GetAirplaneType(des);
printf("print of the value after the function: %s \n", des);
}