C iso646.h Header

Beginner
6 min read
Updated: Nov 2026
3 examples
C95

What Is iso646.h?

<iso646.h> defines readable macro spellings for operators that use symbols: and for &&, or for ||, not for !, bitand for &, and so on.

It was added in 1995 so programs could be typed on keyboards that lack characters such as &, |, ~, and ^. Today it is mostly a style choice.

Remember
#include <iso646.h>

and     &&        bitand  &         and_eq  &=
or      ||        bitor   |         or_eq   |=
not     !         xor     ^         xor_eq  ^=
not_eq  !=        compl   ~
UsePrefer
Logical operatorsand, or, not
Bitwise operatorsbitand, bitor, xor, compl
Compound assignmentand_eq, or_eq, xor_eq
Comparisonnot_eq

How to Use iso646.h in C

Include the header and swap the symbol for the word. Meaning and precedence do not change.

  1. Add #include <iso646.h>.
  2. Replace a symbol with its word: && becomes and.
  3. Remember the macros expand to the same tokens, so precedence is unchanged.
  4. Do not use these words as variable or function names.
  5. Pick one style (symbols or words) for a whole project.
PieceRequired?Role
#include <iso646.h>YesDefines the eleven macros
The operator wordYesA plain preprocessor macro in C (a keyword in C++)
Linker flagsNoNothing to link

Pseudocode

Pseudocode
if (a > 0 and b > 0)        ->  if (a > 0 && b > 0)
if (not done)               ->  if (!done)
flags or_eq MASK            ->  flags |= MASK
mask = compl x bitand 0xFF  ->  mask = ~x & 0xFF

Cheat Sheet

The complete list of eleven alternative spellings.

NameMeaning
and&&
and_eq&=
bitand&
bitor|
compl~
not!
not_eq!=
or||
or_eq|=
xor^
xor_eq^=

Worked Walkthrough — Words Become Symbols

Trace what each spelling expands to for a = 5, b = -2, and two bytes.

Calculation
int a = 5, b = -2;

a > 0 and b > 0   ->  1 && 0  ->  false
a > 0 or  b > 0   ->  1 || 0  ->  true
not (a == b)      ->  !(0)    ->  true

0xF0 bitand 0x3C  ->  0xF0 & 0x3C = 0x30
0xF0 bitor  0x3C  ->  0xF0 | 0x3C = 0xFC
0xF0 xor    0x3C  ->  0xF0 ^ 0x3C = 0xCC

C Examples

Compile with gcc file.c -std=c11 -o out.

Example 1 — Logical Operators as Words

Rewrite &&, ||, and ! with and, or, and not.

C
#include <iso646.h>
#include <stdio.h>

int main(void) {
    int a = 5;
    int b = -2;

    if (a > 0 and b > 0) {
        printf("both positive\n");
    } else {
        printf("not both positive\n");
    }

    if (a > 0 or b > 0) {
        printf("at least one positive\n");
    }

    if (not (a == b)) {
        printf("a and b differ\n");
    }
    return 0;
}

How It Works

  1. and. a > 0 and b > 0 is false because b is negative.
  2. or. a > 0 or b > 0 is true because a is positive.
  3. not. not (a == b) is !(a == b), true because they differ.

Example 2 — Bitwise Operators as Words

Use bitand, bitor, xor, and compl on two bytes.

C
#include <iso646.h>
#include <stdio.h>

int main(void) {
    unsigned x = 0xF0;
    unsigned y = 0x3C;

    printf("AND = %02X\n", x bitand y);
    printf("OR  = %02X\n", x bitor y);
    printf("XOR = %02X\n", x xor y);
    printf("NOT = %02X\n", (compl x) bitand 0xFFu);
    return 0;
}

How It Works

  1. bitand. 11110000 & 00111100 gives 00110000, hex 30.
  2. bitor and xor. They give FC and CC.
  3. compl. ~0xF0 sets all upper bits, so mask with 0xFF to keep one byte: 0F.

Example 3 — Compound Assignment Words

Set, clear, and toggle flag bits with or_eq, and_eq, and xor_eq.

C
#include <iso646.h>
#include <stdio.h>

int main(void) {
    unsigned f = 0x01;

    f or_eq 0x04u;
    printf("after or_eq:  %02X\n", f);

    f and_eq compl 0x01u;
    printf("after and_eq: %02X\n", f);

    f xor_eq 0x0Fu;
    printf("after xor_eq: %02X\n", f);
    return 0;
}

How It Works

  1. or_eq sets a bit. 0x01 | 0x04 is 0x05.
  2. and_eq clears. f &= ~0x01u clears bit 0, leaving 0x04.
  3. xor_eq toggles. 0x04 ^ 0x0F is 0x0B.

Edge Cases & Pitfalls

These macros are easy to mix up with ordinary identifiers.

names

Reserved words

After including the header you cannot name a variable and, or, not, or xor.

c++

Keywords in C++

In C++ these are real keywords and need no header, so C code using them ports easily.

logic

bitand is not and

and is logical (&&); bitand is bitwise (&). Swapping them changes behavior.

style

Mixing styles

Most C code uses symbols. Mixing symbols and words in one file makes it harder to read.

Performance & Portability Notes

ApproachCostBest for
Compile timePlain macros; negligibleAny code base
Run timeIdentical tokens after preprocessing, so zero costSame as the symbols
ToolingSome highlighters and linters do not recognize the wordsCheck your toolchain first

The header only renames operators, so generated code is identical to the symbol form.

Key Takeaways

  • Role: word spellings for operators: and, or, not, and more.
  • Meaning: unchanged; the macros expand to the same tokens.
  • Careful: and is logical and bitand is bitwise.
  • Style: a readability choice, not a feature; stay consistent.

One line: iso646.h lets you write and, or, and not instead of &&, ||, and !.

Frequently Asked Questions

iso646.h defines macros such as and, or, not, bitand, and xor as alternative spellings for the operators &&, ||, !, &, and ^.
Not by itself. In C, and is a macro defined by iso646.h. In C++ it is a built-in keyword.
No. They expand to the same tokens, so precedence and meaning are identical to the symbol versions.
It was added in 1995 for keyboards and character sets that lack symbols such as &, |, ~, and ^.
&&, &=, &, |, ~, !, !=, ||, |=, ^, and ^= have spellings. Operators such as + - * / and ?: do not.
Only if your team prefers it. Most C code uses the symbols, so be consistent within a project.

Next: limits.h

Use integer limits such as INT_MAX and CHAR_BIT.

limits.h tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful