Function 如何创建一个与临时缓冲区一起工作并返回新数组的函数?

Function 如何创建一个与临时缓冲区一起工作并返回新数组的函数?,function,buffer,temporary,Function,Buffer,Temporary,我的教授给了我们这个框架代码,我不知道如何使用声明的变量来编写代码 // This function scans through the input letters // and copies them into a temporary buffer. // The temporary buffer is then copied into a // dynamic array that exactly holds the data. char* delete_repeats(char lett

我的教授给了我们这个框架代码,我不知道如何使用声明的变量来编写代码

// This function scans through the input letters
// and copies them into a temporary buffer.
// The temporary buffer is then copied into a
// dynamic array that exactly holds the data.

char* delete_repeats(char letters[], int size, int& numLetters)
{

    char *temp = NULL;        // Holds unique chars

    char *trimmed = NULL;     // Unique chars with no empty space

    numLetters = 0;



//WRITE THE CODE FOR THIS FUNCTION


    // Return new array
    return trimmed;
}

因此,不要鼓励那些可以通过一门语言的基础教程或“做我的家庭作业”问题来回答的问题,有人可能会投反对票。请看:所以不要鼓励那些可以通过一门语言的基础教程或“做我的家庭作业”问题来回答的问题,有人可能会投反对票。见: