C语言用数组和函数分开正负数.
程序人家帮编好了,可是'\0'没学过,不懂,能帮忙改一下吗?#include<stdio.h>
void split(int*,int*,int*);
int main()
{
int a[20],positive[20],negative[20];
for(int i=0;i<=19;i++)
{
printf("Enter the number:\n");
scanf("%d",&a[i]);
}
split(a,positive,negative);
printf("positive:\n");
for(int i=0;positive[i]!='\0';i++)
{
printf("%d\t",positive[i]);
}
printf("\nnegative:\n");
for(int i=0;negative[i]!='\0';i++){
printf("%d\t",negative[i]);
}
}
void split(int *a,int *positive,int *negative)
{
int i=0,j=0,k=0;
for(;i<=19;i++)
{
if(a[i]>=0)
positive[j++]=a[i];
else
negative[k++]=a[i];
}
positive[j]='\0';
negative[k]='\0';
}
追问:能帮我改下程序吗?把'\0'去掉,我完全看不懂