bool compare(char a[], char b[]){
int lena = strlen(a);
int lenb = strlen(b);
int i=0, j=0;
while(i<=lena && j<=lenb){//comparing null char also
if(a[i] != b[j]) return false;
i++;
j++;
}
return true;
}
int main()
{
char a[] = {‘a’,‘b’,‘c’,‘d’,’\0’};
char b[] = {‘a’,‘b’,‘c’,‘d’,‘e’,’\0’};
cout<<compare(a, b);
return 0;
}
//can we compare null character also in while loop or //not? As in video we are comparing it separately.