2

I have this line:

binary[index] = (tempDecimal % 2) + '0';

Could you explain the usefulness of + '0' in this line of code for me?

Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
Tom Cruise
  • 21
  • 1
  • While this question is about [tag:C] and the other one about [tag:C++], they indeed are about the same effect. – glglgl Feb 18 '19 at 15:27
  • 1
    Yes, this C question should not be marked as a duplicate of the C++ question. While both standards have effectively the same rule, C has the rule because the C standard says so, and C++ has the rule because the C++ standard says so. – Eric Postpischil Feb 18 '19 at 16:08
  • @EricPostpischil I agree here. While there are places in the C++ standard that defer to a specific C standard (e.g., C11), this is not one of those places. – AndyG Feb 18 '19 at 17:00

0 Answers0