I will just drop a short paragraph of code, it will be clearer than words:
int main() { int n; int i; char *p; char names[N][M-1]; scanf(«%d», &n); for (i=0; i<n; i++) scanf(«%s», names[i]); /**********************************************/ ****/* NEED TO DEFINE AND INITIALIZE HERE names_p */**** /**********************************************/ p = (char *) get_all_names(names_p, n); { if (p != NULL) { printf(p); free(p); } return 0; } char *get_all_names(char *names[], int n)
You need to pass names to get_all_names
with the help of names_p
, which you actually need to define as a readable name for the function being passed.
I don’t understand how to define names_p
so that the get_all_names
function get_all_names
accept it, despite the fact that its first argument is of type [[], (and the names itself are of type [] []).
In this example I will be glad to briefly explain the difference between these types and here the necessary castings.
PS - I work in C version 99, but it is desirable that it works on 89 too.
The condition of the task: you can not change anything, you only need to execute a comment written in English (identify and initialize in a specific line)