cn_map / cn_map_set_func_comparison

Syntax

void cn_map_set_func_comparison(CN_MAP map, void (*compare_func)(CNM_NODE *))

Description

Sets the comparison function of map to compare_func. The comparison function is used for tree balancing. This function is not intended to be used after data has been inserted into the CN_Map.

Return Value

N/A

Examples

Basic Usage

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

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

main() {
	//Create a new cn_map
	CN_MAP map = cn_map_init(int, int, NULL);

	//Set the comparison function
	cn_map_set_func_comparison(cn_cmp_int);

	//Free the CN_Map
	cn_map_free(map);
}