C Tutorial/Preprocessor/ifdef — различия между версиями

Материал из C\C++ эксперт
Перейти к: навигация, поиск
м (1 версия: Импорт контента...)
 
(нет различий)

Текущая версия на 10:31, 25 мая 2010

ifdef

The ifdef directive makes substitutions based on whether a particular identifier is defined.


#define USA 1
// #define EUP 1
#include <stdio.h>
#ifdef USA
#define currency_rate 46
#endif
#ifdef EUP
#define currency_rate 100
#endif
main()
{
    int rs;
    rs = 10 * currency_rate;
    printf ("%d\n", rs);
}
460