I expect most of the versions that produce the right answer will end up compiling to the same code. The compiler is smart enough to do the conversions and the math so, in the binary, everything will look the same as:
k = 524288;
That doesn't mean you should use "k = 524288" in your code because people reading the code will have a hard time figuring out why you are using that value. Good programming practice would be for the 1024 constant to have a useful name and the 512 constant to have a useful name.
1 Like