C function (fgets) mitigation
问题 I can't understand why taking the input using fgets always gives me "Wrong password" for my program. However, when I use gets() , like gets(array); it works. Expected outputs: when the password is wrong, prints "Wrong Passwor" and for correct one, let me see my "access is granted": #include <stdio.h> #include <string.h> int main(void) { int n=15; char array[n]; int pass = 0; printf("\n Enter the password : \n"); fgets(array, n, stdin); if(strncmp(array, "password",n)) { printf ("\n Wrong