So the task is to write a piece of code that checks a password for an uppercase letter, lowercase letter, number and a sign, then print out if it's a strong password or a weak one.
However im running into a problem with my code, i've recently started coding so im not very experienced, if anyone could help me fix the code that would be great.
This is my code:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#define MAX 100
int main()
{
char password [MAX];
int up=0,low=0,sign=0,num=0,len=0;
scanf("%s", &password);
for(int i=0; i<=password[MAX]; i++)
{
if(isalpha(password[i]))
{
if(isupper(password[i]))
up++;
else
low++;
}
else
{
if(isdigit(password[i]))
num++;
else
sign++;
}
}
if(up && low && sign && num)
printf("Strong Password\n");
else
printf("Weak password\n");
printf("%d %d %d %d", up, low, sign, num);
return 0;
}