I usually use pointers, because in C, every array will convert to pointers, just before bypassing to a function.
When you are passing a 2D array, you must be sure that the sizes are matched.
so you should do something like this (however you should consider dynamic allocation like calloc):
#include<stdio.h>
#include<string.h>
void printlcs( int i, int j, char *x, const int size, char (*direction)[size])
{
if(i==0 || j==0)
return;
else if(direction[i][j]=='d')
{
printlcs(i-1,j-1,x,size,direction);
printf("%c",x[i-1]);
}
else if (direction[i][j]=='u')
printlcs(i-1,j,x,size,direction);
else
printlcs(i,j-1,x,size,direction);
}
void lcs(char *x, char *y)
{
int i,j,xlength,ylength;
xlength=strlen(x);
ylength=strlen(y);
int val[xlength+1][ylength+1];
char direction[xlength+1][ylength+1];
...
printlcs(xlength+1,ylength+1,x,ylength+1,direction);
}
void main()
{
char x[100],y[100];
printf("enter string x : ");
gets(x);
printf("enter string y : ");
gets(y);
lcs(x,y);
}