Heterocytes are specialized nitrogen-fixing cells found in some filamentous cyanobacteria. These cells provide a source of fixed nitrogen to neighboring cells in exchange for carbon compounds. Heterocytes are essential for the survival of cyanobacteria in nitrogen-deficient environments.