the following C++ code does not work as I wish.
#include <string>
#include <iostream>
int Pointer_Function(char* _output);
int Pointer_to_Pointer_Function(char** text );
int main() {
char* input = "This";
printf("1. %s \n", input);
Pointer_Function(input);
printf("5. %s \n", input);
int test;
std::cin >> test;
}
int Pointer_Function(char* _output) {
_output = "Datenmanipulation 1";
printf("2. %s \n", _output);
Pointer_to_Pointer_Function(&_output);
printf("4. %s \n", _output);
return 0;
}
int Pointer_to_Pointer_Function(char** text ) {
printf("3. %s \n", *text);
char* input = "HalliHallo";
text = &input;
printf("3.1. %s \n", *text);
return 0;
}
I wish as result for printf 5. HalliHallo instead of Datenmanipulation. Because data text must be changed due to &input.
Output:
1.This
2. Datenmanipulation 1
3. Datenmanipulation 1
3.1 HalliHallo
4. Datenmanipulation 1
5. This
Expected Result:
1.This
2. Datenmanipulation 1
3. Datenmanipulation 1
3.1 HalliHallo
4. HalliHallo
5. HalliHallo
How can I give pointer to pointer to a Function as a Parameter? Why does not work my Code?