+ 1

Why prefix and postfix was introduced in c

Is really prefix and postfix necessary in c.. ?

14th Jun 2019, 7:24 PM
Afzal Ali
Afzal Ali - avatar
1 Respuesta
+ 3
~ swim ~ You are on the right track will you comments. Older languages like Fortran didn't have the short increment operators, so a lot of code was in the verbose form. Pre and postfix made the code easier to read and write. The other thing is it made it easier for early c compiles to optimise code. If you were doing a postfix and using the value in calculation, the compiler knew to keep the value in the register, for both the calculation and the post fix. Modern optimising c compilers are very good now so probably not a advantage now.
15th Jun 2019, 1:50 AM
Jared Bird
Jared Bird - avatar