求助,关于C语言字符串数组函数问题
我编写了一个打印字符串数组的函数,但是将字符串数组作为参数传入函数却无法打印,而设置一个指向字符串的指针数组传入函数就能打印了,这是为什么?
程序代码:#include <stdio.h>
#include <string.h>
#define SIZE 256
#define LIM 2
void print_string(char **st, int lim);
int main(void)
{
char input[LIM][SIZE] = {
"my",
"be"
};
print_string(input, LIM);
return 0;
}
void print_string(char **st, int lim)
{
int i;
for(i = 0; i < lim; i++)
puts(st[i]);
}







