cn_map / cn_map_empty

Syntax

CNM_BYTE cn_map_empty(CN_MAP map)

Description

Tests whether the CN_Map map is empty (if its size is 0). Returns 1 if true, or 0 if false.

Return Value

Returns an unsigned char (typedef'd as cnm_byte).

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 0/0 pair
	cn_map_insert(map, &key, &value);

	//Print whether the CN_Map is empty or not
	printf("Map is free? %d\n", cn_map_empty(map));

	//Clear the CN_Map
	cn_map_clear(map);

	//Let's check again.
	printf("Map is free? %d\n", cn_map_empty(map));

	//Free memory
	cn_map_free(map);
}