为什么这个程序运行不起来呢?
这个程序怎么看好象都没有问题,可就是运行不起来,请大神们指教一下,谢谢。
程序代码:
#include <stdio.h>
#include <malloc.h>
void chton(char const ch,int n);
void main()
{
char* str=(char*)calloc(7,sizeof(char));
int i,j=3,m=1;
for(i=1;i<8;i++){
if(i>4){
j++;
m-=2;
}else{
j--;
m+=2;
}
chton(' ',j);
chton('*',m);
printf("\n");
}
free(str);
}
void chton(char const ch,int n)
{
for(;n<=0;n--)printf("%c",ch);
return;
}









看自定义函数好像很简单的样子,