dt_Handle molecule, atom;
  dt_Integer acount, bcount, ccount;

  /* allocate a molecule */
  molecule = dt_alloc_mol();
  /* add an oxygen atom */
  atom = dt_addatom(molecule, 8, 2);
  /* water has been created */

  /* count atoms, bonds, and cycles */
  acount = dt_count(molecule, TYP_ATOM);
  bcount = dt_count(molecule, TYP_BOND);
  ccount = dt_count(molecule, TYP_CYCLE);
  printf("There is %d atom, %d bonds, and %d cycles.\n",
         acount, bcount, ccount);

  /* The atom refers to the molecule as its parent. */
  if (dt_parent(atom) == molecule)
    printf("The parent of atom is the molecule.\n");
  /* Deallocation of the molecule causes
    deallocation of the atom, which makes
    the atom invalid. */

if (dt_invalid(atom) == 1)
printf("The atom is invalid.\n");

There is 1 atom, 0 bonds, and 0 cycles.
The parent of atom is the molecule.
The atom is invalid.