What "pointers array"? You show 2D arrays that contain pointers.
It would make more sense to have an array of pointers:
1 2 3 4 5 6 7
|
const char * st[] = {"howudoing?", "whatsgoingon?", "fucku"};
// The st has 3 elements. 3 pointers.
// st[0] points to string literal "howudoing?"
// st[1] points to string literal "whatsgoingon?"[
// 'h' == st[0][0]
// 'o' == st[0][1]
// 'w' == st[0][2]
|
The 'ch' must be different. Pointers store addresses, but you do need space allocated for characters.
You could have an array
char ch[3][20] = {0};
(conveniently initialized with null characters.
Alternatively, you'll have array of pointers and make them point to space that you allocate dynamically.
Furthermore, you don't test in you code the 'n':
1. User could write a negative number. No characters get copied, but printing uninitialized 'ch' is then an error.
2. n could be more than your shortest word.
3. n could be more than 20.