I am trying to compare two string one stored in memory other is scanned..
the problem is that while reading string from terminal i am using array the length will depend on it.
so, comparing of string will be wrong can't we read string in such a way without using a fixed size and compare it???
Code:
unsigned char b[10];
unsigned char *c="Hello";
for(char x=0;x<6;x++){
b[x]=HSerin();
}
int result = strncmp(c,b, compareLimit);
if(result > 0){
ch='a';
HSerout(ch);
}
else if(result < 0)
{
ch='b';
HSerout(ch);
}
else{
ch='c';
HSerout(ch);
}