I am having trouble figuring out how to check each character in the keyword (argv[1]). I know I am probably missing something super obvious. :(
I have tried saving the string to an array, declaring a new int, but still same problem.
//check to make sure 2nd argument is fully alphabetic
string keyword = argv[1];
for(int i = 0, n = strlen(keyword); i < n; i++)
{
if(isalpha(keyword[i]))
{
printf("Success! \n");
return 0;
}
else
{
printf("Invalid key, must be fully alphabetic. \n");
return 1;
}
}
Expected output should be "Invalid key, must be fully alphabetic." for anything not fully alphabetic. Instead, it only works for the beginning character, not the whole keyword.