Answers for "how to get a char input in c++"

C++
1

how to return char* from function in c++

//Function declaration
char* testfunc()
{
    char* str = malloc(10 * sizeof(char));
    return str;
}

//Calling the function
foo = testfunc();
// Do something with your foo
free(foo);		//It is required to free() memory to avoid memory lead
Posted by: Guest on June-30-2021
0

Character cin(userInput) in c++

char c[10];
    cin.getline(c,10);
Posted by: Guest on September-11-2021

Browse Popular Code Answers by Language