Const before or const after?

why is there two correct ways of specifying const data and in what situation would you prefer or need one over the other if any? Essentially, the reason that the position of const within specifiers prior to an asterisk does not matter is that the C grammar was defined that way by Kernighan and Ritchie. … Read more

Why do assignment statements return a value?

To my understanding, assignment s = “Hello”; should only cause “Hello” to be assigned to s, but the operation shouldn’t return any value. Your understanding is 100% incorrect. Can you explain why you believe this false thing? What is the reasoning behind allowing assignment statements to return a value? First off, assignment statements do not … Read more

Why are hexadecimal numbers prefixed with 0x?

Short story: The 0 tells the parser it’s dealing with a constant (and not an identifier/reserved word). Something is still needed to specify the number base: the x is an arbitrary choice. Long story: In the 60’s, the prevalent programming number systems were decimal and octal — mainframes had 12, 24 or 36 bits per … Read more