Hi All, I have a function that takes 'char *[]' as parameter: void myFunc(char *mystrings[]){} In order to call it I need to create an array of 'char *' and call it. (with malloc and all) Is there anyways to call this function with char[][] instead of char*[]? Something like this: char mystring[2][20]; strcpy(mystring[0], "This is first line"); strcpy(mystring[1], "This is second line"); myFunc(mystring); I've tried myFunc(*mystring) and myFunc(**mystring) already. Thanks
Code: #include <stdio.h> /* a generic method to handle variable no of strings of variable length - */ void genericstrhandler(char *strarray, int numstr, int stringlen); char strings[ 5 ][ 10 ] = { "one", "two", "three", "four", "five" }; void main() { genericstrhandler(strings[ 0 ], 5, 10); } void genericstrhandler(char *strarray, int numstr, int stringlen) { char *p; int i; for( i = 0, p = strarray; i < numstr; i++, p += stringlen ) { printf("%d : %s\n", i, p); } }