#include <stdio.h>
#inlcude <stdlib.h>
#include <string.h>
int main()
{
char ch[80] = "<Hi> How are you </Hi>"; /* This is the string, The output should be
Element : Hi How are you */
int i;
for(i=0;ch[i] != '\0';)
{
if (ch[i] == '<')
{
printf ("Element : ");
i++;
while(ch[i] != '<')
{
if (ch[i] == '>')
{
printf(" ");
i++;
}
else
{
printf ("%c", ch[i]);
i++;
}
}
}
else
i++;
}
return 0;
}
我得到Segmentation fault core dump。没有编译器错误,但是当我运行该程序时,我得到了Segmentation fault core dump。我使用Unix Putty。请检查代码有什么问题
您能否先修复您的缩进并从gdb发回回溯? – thiton
具有'#inlcude'指令的程序如何编译和工作? – glglgl
首先关闭:#inlcude –
Tudor