How to return a static multidimensional array of characters?
#include<stdio.h>
#include<conio.h>
#define SIZE 3
char ** MyFunction(void)
{
static char arr[SIZE][SIZE]={
{'A', 'B', 'C'},
{'D', 'E', 'F'},
{'G', 'H', 'I'}
};
return arr;
}
void main(void)
{
char ** arr1 = NULL;
int i=0;
int j=0;
arr1 = MyFunction();
for(i=0 ; i<SIZE ; i++)
{
for(j=0 ; j<SIZE ; j++)
{
printf("%c, ", arr1[i][j]);
}
printf("\n");
}
getch();
}