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; }

16th Dec 2020, 4:42 AM
Md. Mojnu Miah
Md. Mojnu Miah - avatar
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>.
16th Dec 2020, 4:45 AM
你知道規則,我也是
你知道規則,我也是 - avatar