0
What's wrong here my C code? It's doesn't work what I expected.
#include<stdio.h> int main(){ char *name[10], password[10]; printf("Enter Your Name: "); scanf("%s", name); if(name == 'Kevin' || name='Sakil"){ printf("Enter Your Password please: "); scanf("%s", password); if(password=='1234' || password=='7890'){ printf("You are Successfully Login"); } else{ printf("Access Denied"); } } else{ printf("Access Denied"); } return 0; }
1 Odpowiedź
+ 5
1. To declare a string you don't need pointer if you use array. Use char name[10], password[10].
2. You are mixing ' and ", which are totally different.
3. To check strings equality, use if(strcmp(string1, string2) == 0) from <string.h>.