have this small sample of code:
size_t value;
value = (size_t) strtol(argv[1], NULL, 10);
if (value <= 0) {
fprintf(stderr, "Value cant be 0 or a negative value\n");
return 1;
}
When I run ./prog -1
, it doesn't fail with Value cant be 0 or a negative value
which doesn't make sense to me. Am I missing something?
If I run ./prog 0
, it does fail, but not if the argument is with -
.