I wrote this simple program to compare two strings ,I think it's working properly I just need to confirm that and also have few advices if possible
#include<stdio.h>
// #include<string.h>
int main(){
int value, lenght=0, i=0;
char passwd[11], pass[11]="comptiatar";
printf("enter ur passwd: ");
scanf("%s", passwd);
//value = strcmp(passwd,pass);
while (passwd[i]!=0){
lenght++;
i++;
}
for (i=0;i<=lenght;i++){
if (passwd[i]==pass[i])
value=0;
else {
value=passwd[i]-pass[i];
break;
}
}
if (value)
printf("\nwrong password\n\n");
else
printf("\nlogin successfully\n\n");
printf("%d\n", value);
return 0;}