0
string (*add(string (*str)[10])) [10]; //function return a point to array of 10 string

int main()
{
    string s[10] = {"a","b","c","d","e","f","g","f","i","j"};
    string (*str)[10] = &s;
    string (*str2)[10] = add(str);
    cout << (*str2)[1] << endl;
    return 0;
}

string (*add(string (*str)[10])) [10]
{
    for (int i = 0; i < 10; i++)
        for (auto &c : (*str)[i])
        {
            c = toupper(c);
            cout << c << endl;
        }
    return str;
}

i think those codes which used a point to an array are complex for a fresh man, and other approaches make it easier.

i would like to what it is like to use it in general.

JiangFeng
  • 21
  • 3

0 Answers0