New answers tagged

1

unsigned vs, unsigned long Code mixes use of unsigned and unsigned long as if they are of the 32-bit size. In 2020, 16-bit unsigned is commonly found in embedded processors and 64-bit unsigned long in 64-bit processors. Do not assume unsigned, unsigned long size/range other than they are at least 16, 32 bits. #define UINT_MAXIMUM 4294967294 // UINT_MAX ...


1

It's been a long time since I've heard the terms BCD or Binary Coded Decimal. Keep in mind that BCD was primarily a hardware encoding of integers provided by one particular manufacturer of main frame computers. There were computer performance issues when using BCD. The best way to implement a BCD number would be an array of 4 bit integer values. One good ...


2

What should the output be if I enter 123456789012345678901234567890? That's producing an integer overflow right now.


7

Since command line arguments are null-terminated, we can avoid strlen() entirely by just running through the string until we hit '\0'; this also gets rid of contin and i (*p > 0x2F && *p < 0x3A) isn't very obvious, I'd just use '0' and '9' to make it easier to understand the intention and to be consistent with the rest of the code You could use ...


Top 50 recent answers are included