C Tutorial/Preprocessor/ifndef
ifndef
#ifndef is used to check whether a particular symbol is defined.
<source lang="cpp">#define USA 1
//#define EUP 1
- include <stdio.h>
- ifndef USA
#define currency_rate 100
- endif
- ifndef EUP
#define currency_rate 46
- endif
main() {
int rs; rs = 10 * currency_rate; printf ("%d\n", rs);
}</source>
460