为什么这一小段代码总是运行时错误 求大家帮帮忙

 #include<stdio.h>
#include<string.h>
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n;
        scanf("%d",&n);
        while(n--)
        {
            char a[]=">+";
            char b[]="+>";
            int l,num;
            int i=0;
            scanf("%d%d",&l,&num);
            char t[100];
            for(i=0;i<l-2;i++)
                t[i]='-';
            t[i]='\0';
            char *temp;;
            temp=strcat(a,t);
            temp=strcat(temp,b);
            for(i=0;i<num;i++)
                printf("%s\n",temp);
            printf("\n");
            memset(t,'\0',sizeof(t));
            memset(temp,'\0',sizeof(temp));
            memset(a,'\0',sizeof(a));
        }
    }
    return 0;
}

测试数据要用这个:
1
4
3 4
4 5
5 6
6 7

因为 temp=strcat(a,t); 向数组 a 的空间中写入数据了,但 a 的空间太少,如此操作就越界了。会产生错误:引起数据错误,最严重的会引起程序异常报错。
char a[]=">+"; 最好是给一个实际的大小,如 256。此大小必须保证后继的操作不超过它。

目标数组长度太小,改为:
char a[100]=">+";

你的程序是做什么的,输入的参数什么意义。

但是我运行了下,没有报错。

 1
4
3 4
>+-+>
>+-+>
>+-+>
>+-+>

4 5
>+--+>
>+--+>
>+--+>
>+--+>
>+--+>

5 6
>+---+>
>+---+>
>+---+>
>+---+>
>+---+>
>+---+>

6 7
>+----+>
>+----+>
>+----+>
>+----+>
>+----+>
>+----+>
>+----+>

a,b两个数组大小太小了,开大一点