3 ms·
People who write C nowadays generally try to write it in the most "boring" and easy-to-read way possible, I think. But C can also be hard to understand if it us
by trealira 2y ago
People who write C nowadays generally try to write it in the most "boring" and easy-to-read way possible, I think. But C can also be hard to understand if it uses a lot of side-effectful expressions and pointer arithmetic. Just look at "How Old School C Programmers Process Arguments", which looks over an excerpt from K&R [0]. To make your code slightly harder to read, while still being plausible, you could change it to use pointer arithmetic, like so:
// Printing the squared numbers
printf("[");
for (int n = 5, *p = squared_numbers; --n >= 0; p++)
printf("%d%s", *p, n > 0 ? ", " : "]\n");
[0]: https://www.usrsb.in/How-Old-School-C-Programmers-Process-Arguments.html https://www.usrsb.in/How-Old-School-C-Programmers-Process-Ar...
- thfuran 2y ago>--n >= 0 But n-->0 is prettier.
- deleted 2y ago[deleted]