cn_map / cn_map_clear

Syntax

void cn_map_clear(CN_MAP map)

Description

Frees all nodes allocated in the CN_Map. This does not free the CN_Map itself. For that, call cn_map_free.

Return Value

N/A

Examples

Basic Usage

#include <stdio.h>
#include <stdlib.h>

#include "cn_cmp.h"
#include "cn_map.h"

main() {
	CN_MAP map = cn_map_init(int, int, cn_cmp_int);

	int key   = 0;
	int value = 0;

	//Insert quite a few elements
	for (; key < 1000; key++) {
		cn_map_insert(map, &key, &value);
	}

	//Clear the map
	cn_map_clear(map);

	cn_map_free(map);
}