how to return char 2a from function in c 2b 2b

Solutions on MaxInterview for how to return char 2a from function in c 2b 2b by the best coders in the world

showing results for - "how to return char 2a from function in c 2b 2b"
Kendrick
04 Feb 2018
1//Function declaration
2char* testfunc()
3{
4    char* str = malloc(10 * sizeof(char));
5    return str;
6}
7
8//Calling the function
9foo = testfunc();
10// Do something with your foo
11free(foo);		//It is required to free() memory to avoid memory lead