I am trying to create a function in a C program that gets a 2D char array that is dynamically allocated like this:
char **arr;
int N, M;
scanf("%d%d", &N, &M);
arr = malloc(N * sizeof(char *));
if(arr == NULL)
    {
    printf("Not enough memory\n");
    exit(0);
    }
for(i = 0; i < N; i++)
    {
    arr[i] = malloc(M * sizeof(char));
    if(arr[i] == NULL)
        {
        printf("Not enough memory\n");
        exit(0);
        }
    }
And then returns that array. I have declared the function like this(Before typing the code in main).
char check(char **arr);
Then, to edit the function, I have started like this:
check(**arr) {
         /*code here*/
         return **arr;
}
And to call the function, I use this:
check(**arr);
However, when I try to compile it with gcc -ansi -pedantic -Werror, I get these errors/warnings:
file.c: In function ‘main’:
file.c:42:2: error: passing argument 1 of ‘check’ makes pointer from integer without a cast [-Werror]
  check(**arr);
  ^
file.c:6:6: note: expected ‘char **’ but argument is of type ‘char’
 char check(char **arr);
      ^
file.c: At top level:
file.c:57:7: error: expected declaration specifiers or ‘...’ before ‘*’ token
 check(**arr) {
       ^
cc1: all warnings being treated as errors
Line 42 is when I call the check function in main like I said above. Line 6 is when I declare the check function. Line 57 is when I start editing the function like I said above.
I know I should have probably posted the all of the code but it's a school assignment, so I can't. I know it's annoying and I'm sorry, but using the errors I got in the Terminal I tried to point where the error is. I'm sorry again and thank you for your time.
 
     
     
     
    