check that argument(s) were provided at launch

This commit is contained in:
Roland W-H 2022-05-25 21:31:28 +01:00
parent 470d60f300
commit db2bfd4ee0
1 changed files with 6 additions and 0 deletions

View File

@ -21,6 +21,12 @@ bool isint(char* s)
int main(int argc, char** argv)
{
if (argc < 2)
{
puts("ERROR: Must have at least one argument (number)");
return -1;
}
int* arr = malloc((argc - 1) * sizeof(int));
for (int i = 1; i < argc; i++)
{