When I input the credit card numbers that check50 inputs in its tests to my program myself, It correctly identifies the numbers as expected. However, when I run check50, it's not identifying correctly. Here is some sample output from my console

Testing with check50:

:( identifies 4111111111111111 as VISA
   \ expected output, but not "INVALID\n"

Inputting the same credit card number myself...

jharvard@appliance (~/Dropbox/pset1): ./credit
Number: 4111111111111111

I've tried each of the card numbers and they all work when I manually input them, but not when using check50. Any ideas?

  • I am having this exact same problem. My credit program works perfectly but still has problems on Check50. When I enter the numbers manually the output is correct. Should I still submit my pset solution?
    – Jeka_Peli
    Feb 4 '20 at 16:58

It can sometimes happen that a program works fine locally but fails check50. One common cause of this is using uninitialized variables and/or arrays. The block of memory grabbed locally may be entirely null, so the program works fine. But the machine used by check50 may well give you memory filled with "garbage" that causes your program to behave erratically.

Could that be the issue?

  • Yes, this is probably the only possible cause.
    – ChiCubed
    Jul 21 '14 at 4:33
  • This is DEFINITELY the cause, I've been struggling with this same issue for 2 days. I just initialized all variables to 0 and initialized all arrays with elements of 0 (instead of just declaring the array name and its size. THANK YOU!
    – Jeka_Peli
    Feb 4 '20 at 17:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .