1       #include<stdio.h>
2       #include<stdlib.h>
3       int main ()
4       {
5               char *c[3];
6               char **p;
7               int i=0;
8               p=c;
9               printf("please enter the strings: ");
10              for(p;p<c+3;p++)
(gdb)
11                      scanf("%s",*p);
12              p=c;
13              for(p;p<c+3;p++)
14                      printf("%s",*p);
15              exit(0);
16      }
输入并输出3个不等长字符串,gdb调试出现段错误,backtrace后应该是代码的11行出了问题,不知是什么原因,求解答
-------------- 下一部分 --------------
一个HTML附件被移除...
URL: 
<https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20120228/5d5949ce/attachment.html>
-- 
ubuntu-zh mailing list
ubuntu-zh@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh

回复