#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
void createDynamicArrayForChar(int dimension, char **ptr)
{
    ptr = (char**)malloc(dimension*sizeof(char*));
    for (int i = 0; i < dimension; i++)
    {
        ptr[i] = (char*)malloc(20 * sizeof(char));
        ptr[i] = "value";
    }
}
int main()
{
    char **ptrArray;
    createDynamicArrayForChar(5, ptrArray);
    printf("%s", ptrArray[3]);
    getchar(); getchar();
    return 0;
}
It gives some errors when I try to compile this codes. How can I solve this problem? How to send 2D char pointer to a function in C?
 
     
     
     
    