I was facing with one minor issue, and I’m wondering: Why?
here we have some string:
[NSString stringWithFormat@"%.3f/%.3f/%.3f/%i", 1.0, 1.0, 1, 1];
in this case, result is 1.000/1.000/1/abra-kadabra like 34875689.
Why it’s happens? Of course, I know, when we change the third value to 1.0, then everything will be okay.
So, please, explain me the deep proces of this operation.
Since you wrote
%f, the compiler expects afloatbut recognizes anint. Writing1instead of1.0tells the compiler it’s an integer constant instead of1.0, which is a float constant.