I'm super new to programming and I'm trying to figure out why my program isn't printing out invalid name when I am typing something that is not a-z and A-Z.
Here is my code
#pragma warning(disable : 4996)
#include <stdio.h>
int main()
{
char getFirstNameFromApplicant[50]; //declare variable
printf("Please enter your first name: \n");
scanf("%s", &getFirstNameFromApplicant); //get user input
bool firstNameIsValid = true; //true or false statement
for (int i = 0; getFirstNameFromApplicant[i] != '\0'; i++) { // int i = 0 means position of index, var[i] is the ith position, != '0' will be the end, i++ increments counter
if ((getFirstNameFromApplicant[49] >= 'a' == 0 && getFirstNameFromApplicant[49] <= 'z' == 0) || (getFirstNameFromApplicant[49] >= 'A' == 0 && getFirstNameFromApplicant[49] <= 'Z' == 0)) // var is greater or equal to 'a' or higher is false etc...
firstNameIsValid = false;
break;
}
if (firstNameIsValid = true)
printf("name is valid");
else
printf("name is invalid");
}
any help is appreciated.
I tried all sorts of approaches for true and false and moving things around but I just can't find the right answer.