这个程序能运行出来结果,为啥还会显示debug error?

#include <stdio.h>//打印各个长度的单词数
#define OUT 1
#define IN  0
main()
{
	int state,c,wlength,i,max,z;
	int nlength [20] ;

	for (max = 20, i = 0; i < max; nlength[i] = 0)//给数组初始量赋值为0
		++i;
	state = OUT;
	c = getchar();
	while (c  != EOF)
	{
		if (c == ' ' || c == '\n' || c == '\t')
		{
			state = OUT;
			c = getchar();
		}
		else if (state == OUT)//计算正在读取的单词的长度,并令其数组元素值+1
		{
			state = IN;
			for (wlength = 0; c != '\n' && c != '\t' && c != ' ' && c != EOF; c = getchar())
				++wlength;
			++nlength[wlength];
		}
	}
	for(z=1;z<max;++z)
	printf("%d ", nlength[z]);
	return 0;
}

 

我好像懂了,可能是第一个for语句的第三步错了,应该让++i与nlength【i】=0调换下位置,回来有空再单独试试