Skip to content
Snippets Groups Projects
null_pointer_2.c 300 B
Newer Older
Andre Maroneze's avatar
Andre Maroneze committed
int y=0;
int main() {
  assert(sizeof(int*)==sizeof(char*));
  int *p = NULL;
  char *q = NULL;
  // are two null pointers guaranteed to have the
  //  same representation?
  _Bool b = (memcmp(&p, &q, sizeof(p))==0);
  printf("p=%p q=%p\n",(void*)p,(void*)q);
  printf("%s\n",b?"equal":"unequal");
}