You are comparing the first character of both strings in that condition, to make a string comparison you should go through character to character to know if they are equal, but for that procedure there are already solutions in the standard library, for example "strcmp"
int strcmp(const char *s1, const char *s2);
Compare the string pointed to by s1 with the string pointed to by s2.
The function returns a whole number greater, equal, or less than zero, appropriately according to the string pointed by s1 is greater, equal, or smaller than the string pointed by s2.
An example:
int main()
{
char s1[5] = "Abeja";
char s2[5] = "abeja";
int i;
printf( "s1=%s\t", s1 );
printf( "s2=%s\n", s2 );
i = strcmp( s1, s2 );
printf( "s1 es " );
if( i < 0 ) printf( "menor que" );
else if( i > 0 ) printf( "mayor que" );
else printf( "igual a" );
printf( " s2\n" );
return 0;
}
Your code would be as follows:
#include <string.h>
void listado(char pers[100][9], int& lim){
char busqD[40];
printf("\nCONSULTAS\n\nIngresar el nombre del departamento: ");
fflush(stdin);
gets(busqD);
printf("\n\nID EMPLEADO\tNOMBRE\t\tSALARIO");
for(int i=0;i<lim;i++){
for(int j=0;j<9;j++){
if(strcmp(busqD, pers[i][2]) == 0){//son iguales
printf("\n%i\t %s\t %.2",pers[i][0],pers[i][1],pers[i][8]);
}
}
}