What are C macros useful for?

前端 未结 18 2070
-上瘾入骨i
-上瘾入骨i 2020-11-28 19:45

I have written a little bit of C, and I can read it well enough to get a general idea of what it is doing, but every time I have encountered a macro it has thrown me complet

18条回答
  •  萌比男神i
    2020-11-28 20:04

    Unlike regular functions, you can do control flow (if, while, for,...) in macros. Here's an example:

    #include 
    
    #define Loop(i,x) for(i=0; i

提交回复
热议问题