I want to write a C function that will print 1 to N one per each line on the stdout where N is a int parameter to the function. The function should not use while, for, do-while loops, goto statement, recursion, and switch statement. Is it possible?
相关问题
- Multiple sockets for clients to connect to
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- R: eval(parse()) error message: cannot ope
- Index of single bit in long integer (in C) [duplic
I think it doesn't count as recursion.
You can do this by nesting macros.
There will be 32 macros in total. Assuming size of
int
as 4 bytes. Now callPRINT_32(N)
from any function.Edit: Adding example for clarity.
Another thingy (on linux) would be to do as below where 7 is N
This does it:
Here is another one: