C #define macros

后端 未结 7 1390
情书的邮戳
情书的邮戳 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:24

    Order of operations.

    FTIMES(j+5) where j=1 evaluates to:

    1+5*5

    Which is:

    25+1

    =26

    By making FTIMES((j+5)) you've changed it to:

    (1+5)*5

    6*5

    30

提交回复
热议问题