Description
First of all I would like to thank you for providing a great tutorial for C language. U helped me get a confidence that even I can code.
The issue is that I tried the code for the challenge 1 in C language.
The question was : To create a code to check whether the password has a alphabet, a number and a $ sign.
The code I entered is :
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
int main()
{
char password[50];
printf("please set a password with '$' sign: \n");
scanf(" %s", password);
( password == (isalpha(password)) && (isdigit(password)) && ('$') ) ? printf("Ur password is OK and u r good to go\n") : printf("Try a new password as per the terms and condition\n");
return 0;
}
I even tried with a normal If and Else loop but I am unable to get the answer. The above code runs without any error but directly jumps into the Else part.
I tried to refer ur website but the website isn't opening. Kindly help me to know the mistake done in this code.
Output obtained for the above mentioned code:
Using If and Else method :