XCODE运行程序的时候出现Thread 1: signal SIGABRT求解决方法

我请问下,XCODE运行程序的时候出现Thread 1: signal SIGABRT求解决方法?

源代码如下:
#include "stdio.h"

int main ()

{

int num[100];

char in[201];

char fh[200];

int i, j, flag = 0;

/*initialise*/

for (i = 0; i < 200; i++)

{

num[i] = 0;

in[i] = '\0';

fh[i] = '\0';

}

for (i = 0; i < 200; i++)

{

scanf("%c", &in[i]);

if (in[i] == '\n')

break;

}

/*get number from the string*/

for (i = 0, j = 0; i < 200; i++)

{

while ((in[i] <= '9') && in[i] >= '0')

{

num[j] = num[j] * 10 + (in[i] - '0');

i++;

}

if (in[i] == ' ')

flag++;

if (flag == 2)

{

j++;

flag = 0;

}

}

// use for test the number

for (i = 0; i < 200; i++)

printf("%d\n", num[i]);

/*get the symbol from the string*/

for (i = 0, j = 0; i < 200; i++)

{

if((in[i] >= '*') && in[i] <='/')

{

fh[j] = in[i];

j++;

}

}

// use for test the symbol

puts(fh);

return 0;

}
顺便能解释下
Thread 1: signal SIGABRT
出现时常见的原因么?
最新回答
卿弦季鸢

2024-05-12 10:15:19

数组下标越界了,num数组只开了100,但是在初始化的时候就循环200,这明显下标越界啊