`#include<reg51.h>
#include<string.h>
#include"_LCD_R8C.c"
unsigned char c[11];
void serial_int (void) interrupt 4
{
static unsigned char chr[11];
int i,j;
if (RI==1)
{
RI = 0;
TI = 0;
chr[11] = SBUF;
for(j=0;j<1;j++)
{
for(i=0;i<=10;i++)
{
c[i]=chr;
}
c[11]='\0';
}
}
}
int main() { unsigned char a[2][11]={"$0016221826","$0123456789"}; int i,j; lcd_init(); lcd_clear(); SCON = 0x50; TMOD = 0x20; TH1 = 0xFD; ET0 = 0; TR1 = 1; RI = 1; ES = 1; EA = 1; for(i=0;i<=1;i++) { **j=strcmp(a,c);** if(j==0) { lcd_printxy(1,1,"yes"); } else { lcd_printxy(1,6,"no"); } } }`
the compiler is giving warning in line 55(BOLD): pointer to different objects. how about array to string conversion? is it correct? the received string should compare with the available array of strings..
"$0016221826"is not 11 characters, it's actually 12 characters (you forgot about the terminating'\0'character).chararray everywhere acharpointer is expected. what makes an array a "string" is the type (char) and that it ends with zero.