cpp
#define LEN(x) (sizeof(x)/sizeof(x[0]))
int longestCommonSubsequence(char* text1, char* text2)
{
int n1 = LEN(text1) - 1;
int n2 = LEN(text2) - 1;
}
sizeof(text1)得到的是指针的大小,LEN(text1) = sizeof(text1)/sizeof(text1[0]) 在64位系统下为8/1=8。
计算字符数组长度应直接用strlen()。