I have started working on Caesar and I am stuck with how to repromt user for a command line argument incase they input some wrong values.
Here is the code i wrote and I can't find any apparent errors
#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>
#include <ctype.h>
int main (int argc, string argv[])
{
do
{
printf("Usage: ./caesar key");
return 1;
}
while (argc != 2 || !isdigit(argv[1]));
}
I am getting the printf message even when the input values are correct. What exactly is going wrong here?
./caesar 2a
-> you have two arguments and the FIRST digit ofArgv[1]
is a number. Im guessing that this is your mistake – leonardo antunes Oct 5 '20 at 15:46