C Tutorial/Preprocessor/ifndef

Материал из C\C++ эксперт
Перейти к: навигация, поиск

ifndef

#ifndef is used to check whether a particular symbol is defined.


<source lang="cpp">#define USA 1 //#define EUP 1

  1. include <stdio.h>
  2. ifndef USA
  #define currency_rate 100    
  1. endif
  2. ifndef EUP
  #define currency_rate 46
  1. endif

main() {

   int rs;
   rs = 10 * currency_rate; 
   printf ("%d\n", rs);

}</source>

460