I am trying to replace last 2 digits of a integer with 38. I am doing that like below.
int num = 1297;
num = (num/100)*100 + 38;
What i am assuming is that compiler won't optimize (num/100)*100 to num. If that happens then in my above example, num will become 1335 instead of 1238. So, is it guaranteed in C that the above expression won't be optimized? Or is there any better way of replacing last 2 digits with some number?