如何在c中返回char(*)[6]?

Old*_*ool 4 c arrays pointers function multidimensional-array

我想按字母顺序排序字符串数组,这是c中字符数组的数组.这是我函数的主体: -

char (*)[6] sort_strings ( char (*sptr) [6])
{

     //code.
     //return a pointer of type char (*)[6].

}
Run Code Online (Sandbox Code Playgroud)

但编译器无法识别这种类型的返回类型.它给出了错误说: -

预期标识符或'('''''''令牌

那么我如何返回char(*)[6]类型的指针?我还有另一个问题,首先看main()如下: -

int main(){

    char names[5][6] = {

            "tom",
            "joe",
            "adam"
    };

    char (*result)[6] = sort_strings (names);

    //code for printing the result goes here.

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

所以我的下一个问题是,当我调用sort strings (names)编译器时也会给我警告: -

初始化使得整数指针不带强制转换

所以我的问题是: -

1.如何从函数返回char(*)[6]?

2.当我调用此函数时,为什么编译器会给我警告?

我在Windows上的代码块上运行此代码.

use*_*751 10

函数声明看起来像变量声明,除了变量名由函数名和参数替换.所以:

// asdf is a pointer to an array of 6 chars
char (*asdf)[6];

// sort_strings is a function returning a pointer to an array of 6 chars
// (and with an argument which is a pointer to an array of 6 chars)
char (*sort_strings ( char (*sptr)[6] )) [6];
Run Code Online (Sandbox Code Playgroud)