C Tutorial/Preprocessor/ifdef


Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /var/www/cppe.ru/www/includes/parser/Preprocessor_DOM.php on line 803

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/vendor/mediawiki/at-ease/src/Functions.php on line 48
Материал из C\C++ эксперт
Перейти к: навигация, поиск

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