为什么该段代码各个函数中字符串都不是我输入的结果
#include <stdio.h>
#include <stdlib.h>
int judge1(char (*nums)[5],int i);
int judge2(char (*nums)[5],int i);
int judge3(char (*nums)[5],int i);
int judge4(char (*nums)[5],int i);
int main(int argc, char *argv[])
{
int i,k,n;
scanf("%d",&n);
char **nums=(char**)malloc(n*sizeof(char*));
int *score=(int*)malloc(n*sizeof(int));
for(i=0;i<n;i++)
{
nums[i]=(char*)malloc(5*sizeof(char));
score[i]=0;
}
for(i=0;i<n;i++)
{
scanf("%s",nums[i]);
score[i]+=judge1(nums,i)+judge2(nums,i)+judge3(nums,i)+judge4(nums,i);
}
for(i=0;i<n;i++)
{
printf("%d\n",score[i]);
}
return 0;
}
int judge1(char (*nums)[5],int i)
{
printf("函数中nums[i]:%s\n",nums[i]);
int a=0;
if(nums[i][0]-nums[i][1]==1&&nums[i][1]-nums[i][2]==1&&nums[i][2]-nums[i][3]==1)
a+=5;
if(nums[i][0]-nums[i][1]==-1&&nums[i][1]-nums[i][2]==-1&&nums[i][2]-nums[i][3]==-1)
a+=5;
return a;
}
int judge2(char (*nums)[5],int i)
{
int a=0;
if(nums[i][0]==nums[i][1]&&nums[i][1]==nums[i][2])
a+=3;
if(nums[i][1]==nums[i][2]&&nums[i][2]==nums[i][3])
a+=3;
return a;
}
int judge3(char (*nums)[5],int i)
{
int a=0;
if(nums[i][0]==nums[i][2]&&nums[i][1]==nums[i][3])
a+=1;
if(nums[i][0]==nums[i][1]&&nums[i][2]==nums[i][3])
a+=1;
return a;
}
int judge4(char (*nums)[5],int i)
{
int a=0,k=0;
for(k=0;k<4;k++)
{
if(nums[i][k]==54||nums[i][k]==56||nums[i][k]==57)
a+=3;
}
return a;
}
结果如下,通过int judge1(char (*nums)[5],int i);传递参数,但为什么函数中nums[i]这个字符串有问题?