I'm trying to use atoll to convert a string of numbers with spaces. I want to make a loop in C that will only take positive numbers.
So far, from what I understand, atoll on a char would return 0, likewise with a combination of an int and char, such as "3a". However, is there a range of values for negative numbers for atoll on a negative number?
I found that the result of -1 is 18446744073709551615, -2 is 18446744073709551614, -3 is 18446744073709551613, etc, based on my first print statement.
for(arg = 1; arg < argc; ++arg)
{
printf("%llu\n", atoll(argv[arg]));
if(atoll(argv[arg]) == 0 || atoll(argv[arg]) >= xxxxx))
{
printf("Enter a valid number.");
}
else
{
printf("irrelevant code here");
}
}