任何人都可以解释输出

时间:2013-03-02 14:11:41

标签: c macros output printf

#define power(a) #a
  int main()
  {
    printf("%d",*power(432));
     return 0;
  }

任何人都可以解释o / p ??
the o/p is

52

2 个答案:

答案 0 :(得分:12)

相当于:

printf("%d",*"432");

相当于:

printf("%d", '4');

'4'的ASCII值为52

答案 1 :(得分:0)

#define power(a) #a   //# is a stringization operation in macro
  int main()
  {
    printf("%d",*power(432));
     return 0;
  }

Hence after calling power(432), macro will return it "432" and applying * on it gives first value which is nothing but 52 (48 + 4) for '4' .