My final working code below
Code:
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <malloc.h>
char **teststr2 = NULL;
char **testfn3(char **);
int main()
{
int i = 0;
teststr2 = testfn3((char **)teststr2);
for(i = 0; i < 20; i++) {printf("%d ++ %s\n", i, teststr2[i]);}
/*Free memory:*/
for(i = 0; i < 20; i++) {free(teststr2[i]);}
free(teststr2);
}
char **testfn3(char **tests1)
{
int i;
tests1 = calloc(21, sizeof(*tests1));
for(i = 0; i < 20; i++) {tests1[i] = calloc(6, sizeof(**tests1)); /*Also works with int*/ sprintf(tests1[i], "Hello";}
for(i = 0; i < 20; i++) {printf("%d = %s\n", i, tests1[i]);}
return tests1;
}