3 ms·
puts isn't applicable here because you actually need to format the %d, but any compiler worth using (i.e. not MSVC: https://gcc.godbolt.org/z/zx74vY1za https://
by jmgao 3y ago
puts isn't applicable here because you actually need to format the %d, but any compiler worth using (i.e. not MSVC: https://gcc.godbolt.org/z/zx74vY1za https://gcc.godbolt.org/z/zx74vY1za) will optimize a printf of a constant string ending in a newline into a puts.
- cypress66 3y agoNo you don't need to format the %d. The same way you collapsed the loop into the constant 5, you collapse that printf into puts("5\n")