im on the credit problem trying to use get_long to get a card number, but when i print out the result of get_long, im getting a completely different number from the one i give it.
the function looks like this
long getCardNum (void)
{
long n;
do
{
n = get_long("enter number: ");
printf("n: %lo\n", n);
}
the while statement just checks that n is more than 1. If i give it "456" it gives me "710", "1357913579" gets "12074016753", and so on. cs50 docs haven't been much help trying to figure out whats happening and i haven't seen quite the same question on here. i just need to know if i'm missing something or if i just need to use some other method to get a card number. do i need to use something besides %lo in the printf call or should i use a different data type for the number? please let me know if im just missing something obvious.
o
in the format string, it converts the number to octal. Tryu
instead. FYI man printf