I'd like to write a short for-loop (with or without macro) that works by guessing if the start point is smaller or bigger (or equal) to the end point, something like this:
fr(i = 0 .. 3) printf("%d ", i)
output: 0 1 2 3
fr(i = 8 .. 3) printf("%d ", i)
ouput: 8 7 6 5 4 3
fr(i = 3 ..< 6) printf("%d ", i)
output: 3 4 5
fr(i = 5 ..> 1) printf("%d ", i)
output: 5 4 3 2
In a nutshell, I'd like to write a powerful for in a short way... Is this possible?
If it isn't, is there another way?