M
MN
I have 2 questions:
1- Why isn't possible to declare a static char array [length][m+1]
inside function ?
the compiler gives this error: storage size of ‘array’ isn’t
constant.
2- Why isn't possible to output the whole array with 2 dimensions from
function?
my function looks like this:
char* function(int m, int reverse, int length)
{
static char array [length][m+1]; /* +1 bit is for stroing the '\0'
character*/
...
/* Do some calculation and store each result in each array's
element*/
.....
return (&array [ ] [m+1]); /* output all array's elements*/
}
Thanks for tacking a time to help me.
1- Why isn't possible to declare a static char array [length][m+1]
inside function ?
the compiler gives this error: storage size of ‘array’ isn’t
constant.
2- Why isn't possible to output the whole array with 2 dimensions from
function?
my function looks like this:
char* function(int m, int reverse, int length)
{
static char array [length][m+1]; /* +1 bit is for stroing the '\0'
character*/
...
/* Do some calculation and store each result in each array's
element*/
.....
return (&array [ ] [m+1]); /* output all array's elements*/
}
Thanks for tacking a time to help me.