c语言-字符串数组的输入解决方法

c语言-字符串数组的输入

#include <stdio.h>

int main()
{
    char *a[4];
    a[0] = "ab"; // 执行这句时出现segmentation fault (core dumped);
    a[1] = "bc";
    a[2] = "cd";
    a[3] = "de";

    return 0;
}


错误如代码中注释所示,知道原因所在的告诉俺吧,实在被这个问题搞蒙了。
------解决方案--------------------
看错了  数组的数组   2维都要有确定的大小   char a[4][3];
------解决方案--------------------
不可能segment fault
------解决方案--------------------
#include <stdio.h>
#include <iostream.h>
int main()
{
char *a[4];
a[0] = "ab";
a[1] = "ab";
a[2] = "ab";
a[3] = "ab";
for (int i = 0;i<4;i++)
{
cout<<a[i]<<'\t';
cout<<'\n';
}
return 0;
}
我运行了一下,没有问题啊。。。
------解决方案--------------------
这是一个指针数组。

这用使用是正确的, 没有错啊。

是不是编译器出问题了?