C #define macros

后端 未结 7 1393
情书的邮戳
情书的邮戳 2020-12-21 06:59

Here is what i have and I wonder how this works and what it actually does.

#define NUM 5
#define FTIMES(x)(x*5)

int main(void) {
    int j = 1;
    printf(\         


        
7条回答
  •  不知归路
    2020-12-21 07:12

    The reason this happens is because your macro expands the print to:

    printf("%d %d\n", j+5*5, (j+5)*5);
    

    Meaning:

    1+5*5 and (1+5)*5
    

提交回复
热议问题