summaryrefslogtreecommitdiff
path: root/test/regression/funptr2.c
blob: 8086eae125ed73203fc202615d9aec6e9771bbe1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* Comparisons of pointers to functions */

#include <stdio.h>

int f(void) { return 0; }
int g(void) { return 1; }

int main(void) {
  printf ("f == f is %d\n", &f == &f);
  printf ("f == g is %d\n", &f == &g);
  /* The following is undefined behavior */
  printf ("f + 2 == f is %d\n", ((char *) &f) + 2 == (char *) &f);
  return 0;
}