Skip to content

MapTryGetPtr

MapTryGetPtr

Description

Try to get pointer to the first value stored for a key.

This is an alias for MapGetFirstPtr with a more stdlib-style lookup name.

Parameters

Name Direction Description
m in,out Map.
key in Key to search for.

Success

Pointer to the first value stored for the key.

Failure

NULL

Usage example (Cross-references)

Usage examples (Cross-references)
        MapInsertR(&map, 11, 111);
    
        int *value  = MapTryGetPtr(&map, 11);
        bool result = value && (*value == 110);
        result      = result && (MapTryGetPtr(&map, 999) == NULL);
        int *value  = MapTryGetPtr(&map, 11);
        bool result = value && (*value == 110);
        result      = result && (MapTryGetPtr(&map, 999) == NULL);
    
        MapDeinit(&map);
Last updated on