Like you allocate memory for anything using malloc().
Code:
ch = malloc(whatever_number_of_pointers_required * sizeof(char *));
or, idiomatically, using the fact that sizeof() evaluates the size of its argument, but does not actually evaluate the argument.
Code:
ch = malloc(whatever_number_of_pointers_required * sizeof(*ch));
This allocates a number of pointers to char. Those pointers, if you wish to dereference them, also need to point to something valid. If you want to dynamically allocate each pointer to char as well (which is one way of making the pointers point at something valid) then you might do this.
Code:
ch = malloc(whatever_number_of_pointers_required * sizeof(*ch));
if (ch != NULL)
{
int i;
for (i = 0; i < whatever_number_of_pointers_required; ++i)
{
ch[i] = malloc(whatever_number_of_chars_required_for_i * sizeof(ch[i]));
/* assume whatever_number_of_chars_required_for_i is at least 2 */
if (ch[i] != NULL) strcpy(ch[i], "A");
}
}
It is necessary to #include <stdlib.h> in order to properly use malloc(), and <string.h> in order to use strcpy().
The other thing to remember with malloc() is that it is good practice to match every call of malloc() with a call of free(), when your program no longer needs the memory allocated.