How to return char (*)[6] in c?

arrays, c, function, multidimensional-array, pointers

Solution

Function declarations look like variable declarations, except that the variable name is replaced by the function name and arguments. So:

// 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];

Problem

I want to sort array of string, which is array of array of characters in c, in alphabetical order.Here is the body of my function :- ``` char (*)[6] sort_strings ( char (*sptr) [6]) { //code. //return a pointer of type char (*)[6]. } ``` But this type of return type is not recognized by the compiler.It gives error saying:- expected identifier or '(' before ')' token So how do i return a pointer of type char (*)[6]? I have another question in mind, firstly see the `main()` as follows:- ``` int main(){ char names[5][6] = { "tom", "joe", "adam" }; char (*result)[6] = sort_strings (names); //code for printing the result goes here. return 0; } ``` So my next question is that when i call `sort strings (names)` compiler is also giving me warning :- initializing makes pointer from integer without a cast So my questions are :- 1. How to return char(*)[6] from a function? 2. Why the compiler giving me warning when i call this function? I am running this code on code blocks on windows.

Original source