Soumendra M. answered 05/31/19
Tutor
5
(6)
Learn and Enjoy Math-Phy-CS-EE
You can use recursion to implement this:
inline int my_print(int i) {
(i -1) && my_print(i-1); std::cout<<i << " "; return 1;
}
Anding of (i-1) makes sure the recursion stops when i is 1.
Now my_print(1000) will print 1 through 1000