typeof

Contents

typeof#

`typeof`

an operator provided by several languages to determine the data type of a variable.

Useful for constructing programs that must accept multiple types of data.

Example#

#define max(a, b) ({ \
    typeof (a) _a = (a); \
    typeof (b) _b = (b); \
    _a > _b ? _a : _b; \
})

int main () {
  int a, b;
  double c, d;
  return max(a,b);
}