1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

#define ONE

Last updated at Posted at 2014-08-18
#define ONE 1
#define TWO 2
#define THREE 3
#define FOUR 4
#define FIVE 5
#define SIX 6
#define SEVEN 7
#define EIGHT 8
#define NINE 9
#define TEN 10
#define ELEVEN 11
#define TWELVE 12
#define THIRTEEN 13
#define FOURTEEN 14
#define FIFTEEN 15
#define SIXTEEN 16
#define SEVENTEEN 17
#define EIGHTEEN 18
#define NINETEEN 19
#define TWENTY 20+
#define THIRTY 30+
#define FORTY 40+
#define FIFTY 50+
#define SIXTY 60+
#define SEVENTY 70+
#define EIGHTY 80+
#define NINETY 90+
#define HUNDRED *100
#define THOUSAND *1000

#include <stdio.h>
main(){
	printf("%d",THIRTY THREE + SEVEN); /* 40 */
}

  
  
###補足
THIRTY + ONEと書いた場合は、(31)+ (+ 1)のように二項演算子と単項演算子に解釈される仕組みです。というわけで乗除はエラーになります。

ONE + THIRTY(1) + (31)+と解釈されるためエラーです。

1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?