Back to index

glibc  2.9
Functions
tst-hsearch.c File Reference
#include <search.h>
#include <stdio.h>

Go to the source code of this file.

Functions

int main (void)

Function Documentation

int main ( void  )

Definition at line 5 of file tst-hsearch.c.

{
  int a = 1;
  int b = 2;
  ENTRY i;
  ENTRY *e;

  if (hcreate (20) == 0)
    {
      puts ("hcreate failed");
      return 1;
    }

  i.key = (char *) "one";
  i.data = &a;
  if (hsearch (i, ENTER) == NULL)
    return 1;

  i.key = (char *) "one";
  i.data = &b;
  e = hsearch (i, ENTER);
  printf ("e.data = %d\n", *(int *) e->data);
  if (*(int *) e->data != 1)
    return 1;

  return 0;
}

Here is the call graph for this function: