我制作了一个程序来查找两个数组中包含的值以及这些值的计数,但是我的程序不起作用:
#include<stdio.h>
#define SIZE 100
void search(char arr1[10][10],char arr2[10][10])
{ //int x = sizeof(arr1); int y = sizeof(arr2)
int j,k;
for( j=0;j<SIZE-1;j++)
{
for( k=0;k<SIZE-1;k++)
{ int count = 0;
if(arr1[j][0] == arr2[k][0])
{
count += 1;
}
}
return count;
printf("StudentID\t : BooksTanken\t\n");
printf("%c \t\t %d \t\n",arr1[j][0],count); }
}
int main()
{
// char array1[2][1],array2[5][1];
char array1[3][2]={
{'ID1','srini'},
{'ID2','Albie'},
{'ID3','Kaasi'}};
char array2[6][2]={
{'ID1','OOPS'},
{'ID2','STS'},
{'ID1','STS'},
{'ID1','CTC'},
{'ID3','MAT'},
{'ID2','MAT'}};
printf("We're Begining the Comaprison Here !!\n\n");
search(array1,array2);
}
任何帮助,将不胜感激。