INPUT int main(void) { long long cardnumber, calc; string credit[0]; string nonnumeric; //long long calc = card number; int countcardcharacters = 0; long long c;
//user input
do
{
credit[0]= get_string("Card number: ");
}
while (credit < 0);
printf("%lli\n", cardnumber);
/*checksum(long long calc);
{
}*/
cardnumber = long long strtoll(const char credit, &nonnumeric, 10);
calc = cardnumber;
//credit[0] = cardnumber;
//printf("%li\n", credit[0]);
//amex
if (strlen(credit[0]) == 15)
{
while (credit[0][0] == 3 && (credit[0][1] == 4 || credit[0][1] == 7))
{
//american express
printf("lol");
}
}
OUTPUT clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow credit.c -lcrypt -lcs50 -lm -o credit credit.c:33:18: error: expected expression cardnumber = long int strtoll(const char credit, &nonnumeric, 10); ^ 1 error generated. : recipe for target 'credit' failed
long int
and 2) expects as parameters. That is the proximate cause of the compile error.strtoll
call would look something likenum = strtoll(somestring,NULL,10)
. Read the man page to find out why NULL can be used for the second argument.