summaryrefslogtreecommitdiff
path: root/test/regression/funptr2.c
blob: 5c31dd2d23888e57b3ab3c7d6d8b4437dcaf9280 (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 + 1 == f is %d\n", ((char *) &f) + 1 == (char *) &f);
  return 0;
}