I am studying the transfer of 2D arrays to functions in C and found out that I can get a 2D array in a function as follows:
void test(char a[5][10])void test(char (*a)[10])
The above declarations work for me, but looking at the **argv parameter of the main function, I was thinking about changing my function to void test(char **a) . But this does not work correctly. I do not understand why. Please explain.
Here is my code
#include<stdio.h> int main(int argc, char **argv){ char multi[5][10] = { {'0','0','2','3','4','5','6','7','1','9'}, {'a','b','c','d','e','f','g','h','i','j'}, {'A','B','C','D','E','F','G','H','I','J'}, {'9','8','7','6','5','4','3','2','1','0'}, {'J','I','H','G','F','E','D','C','B','A'} }; test(multi); return 0; } void test(char (*a)[10]) // void test(char **a) does not work { printf("\na[2][1] is: %d",*(*(a + 2)+1)); }