2 votes
Accepted

PSet 2: Caesar, validating key

The problem lies here: if(isdigit(argv[1][i] != true) You need to fully understand how isdigit() works, specifically the return value, and the numeric value of true. The is() family of functions ...
  • 64.7k
2 votes
Accepted

Problem with Validating the Key for Caesar

Your return 1; will immediately end the program (ie, if the first character is a digit, your program will print success) so no further characters are checked. You should reverse how you are checking ...
  • 18.4k
1 vote
Accepted

How do I check that every character of an array is a digit and only print out the string if all the chars are digits?

Program doesn't know if all the characters in key are digits until after it has processed all of them. The "Success" message should come after the for loop is finished. And remember this ...
1 vote

CS50-pset2-Validating the Key-how to check or reject the user's input is decimal or not

You are meant to reject any number of command-line arguments other than one (means argc should be 2). To test whether a given character is numeric/alphabetic, you can use the isdigit/isalpha function (...
  • 20.7k

Only top scored, non community-wiki answers of a minimum length are eligible