2 add syntax highlighting
source | link

Try the following.

// -*- compile-command: "gcc -Wall -o sizeof sizeof.c && ./sizeof" -*-

#include <stdio.h>
#include <limits.h>

#define size(t) { t x; printf("%s:\t%3lu bit\n", #t, CHAR_BIT * sizeof x); }

int main (int argc, char *argv[])
{
  size(char);
  size(short);
  size(int);
  size(long);
  size(void*);
  return 0;
}
// -*- compile-command: "gcc -Wall -o sizeof sizeof.c && ./sizeof" -*-

#include <stdio.h>
#include <limits.h>

#define size(t) { t x; printf("%s:\t%3lu bit\n", #t, CHAR_BIT * sizeof x); }

int main (int argc, char *argv[])
{
  size(char);
  size(short);
  size(int);
  size(long);
  size(void*);
  return 0;
}

The address size is void*.

Try the following.

// -*- compile-command: "gcc -Wall -o sizeof sizeof.c && ./sizeof" -*-

#include <stdio.h>
#include <limits.h>

#define size(t) { t x; printf("%s:\t%3lu bit\n", #t, CHAR_BIT * sizeof x); }

int main (int argc, char *argv[])
{
  size(char);
  size(short);
  size(int);
  size(long);
  size(void*);
  return 0;
}

The address size is void*.

Try the following.

// -*- compile-command: "gcc -Wall -o sizeof sizeof.c && ./sizeof" -*-

#include <stdio.h>
#include <limits.h>

#define size(t) { t x; printf("%s:\t%3lu bit\n", #t, CHAR_BIT * sizeof x); }

int main (int argc, char *argv[])
{
  size(char);
  size(short);
  size(int);
  size(long);
  size(void*);
  return 0;
}

The address size is void*.

1
source | link

Try the following.

// -*- compile-command: "gcc -Wall -o sizeof sizeof.c && ./sizeof" -*-

#include <stdio.h>
#include <limits.h>

#define size(t) { t x; printf("%s:\t%3lu bit\n", #t, CHAR_BIT * sizeof x); }

int main (int argc, char *argv[])
{
  size(char);
  size(short);
  size(int);
  size(long);
  size(void*);
  return 0;
}

The address size is void*.