In this function, I am reading in a 'license plate' and comparing to all 'licence plates' in my array. If there is a match, then null that part of the array (the car is leaving). It seemed to work fine but I discovered that if the plate number began with 'd' then the program nulls all plate numbers beginning with d. My for loop looks okay but I am not sure how to fix it. Suggestions???
void Delcar (char cars [MAX][PLATE])//function to delete a car
{
int i,x;
int counter;
counter=CINIT;
char tarray[PLATE]={'\0'};
char ch;
do
{
scanf("%s",tarray);
{for (x=LINIT;x<MAX;x++)
for (i=LINIT;i<=PLATE;i++)
{
if (cars[x][i]==tarray[i])
{
cars[x][i]='\0';
printf("Car left space %d\n",x+1);
counter++;
}
break;
}
}
}
while (counter<=CINIT);
Options(); //function to call main menu
scanf("%c",&ch);
}