### Build and install tomlc99 using make Source: https://github.com/cktan/tomlc99/blob/master/README_old.md Provides instructions for building and installing the tomlc99 library using the `make` command. It covers default installation and custom installation paths. ```makefile # Build make # Install to default location (/usr/local/include, /usr/local/lib) make install # Install to a custom prefix make install prefix=/a/file/path ``` -------------------------------- ### Access TOML array content by index in C Source: https://github.com/cktan/tomlc99/blob/master/README_old.md Demonstrates how to access elements within a TOML array using integer indices in C. It includes functions for retrieving various data types and getting the array size. ```c int size = toml_array_nelem(arr); toml_string_at(arr, idx); toml_bool_at(arr, idx); toml_int_at(arr, idx); toml_double_at(arr, idx); toml_timestamp_at(arr, idx); toml_table_at(arr, idx); toml_array_at(arr, idx); ``` -------------------------------- ### Retrieve Double/Float from TOML Source: https://context7.com/cktan/tomlc99/llms.txt Retrieves a double-precision floating-point value from a TOML table by its key. It returns a `toml_datum_t` with `ok=1` on success, and the value is stored in `u.d`. The example demonstrates retrieving 'pi' and 'rate', formatting the output accordingly. ```c // Config: pi = 3.14159 // rate = 0.05 // infinity = inf // not_a_number = nan toml_datum_t pi = toml_double_in(conf, "pi"); toml_datum_t rate = toml_double_in(conf, "rate"); if (pi.ok) printf("Pi: %f\n", pi.u.d); // Output: Pi: 3.141590 if (rate.ok) printf("Rate: %.2f%%\n", rate.u.d * 100); // Output: Rate: 5.00% ``` -------------------------------- ### Get Number of Array Elements Source: https://context7.com/cktan/tomlc99/llms.txt Returns the number of elements within a TOML array. This function is useful for determining the size of an array before iterating through its elements. The example shows getting the count of elements in an 'items' array. ```c toml_array_t *items = toml_array_in(conf, "items"); if (items) { int count = toml_array_nelem(items); printf("Array has %d elements\n", count); } ``` -------------------------------- ### Retrieve Array from TOML Source: https://context7.com/cktan/tomlc99/llms.txt Retrieves an array from a TOML table using a key. It returns a pointer to `toml_array_t` if the key exists and contains an array, otherwise it returns NULL. The example shows retrieving a 'ports' array and iterating through its integer elements. ```c // Config: ports = [8080, 8181, 8282] // hosts = ["localhost", "192.168.1.1"] toml_array_t *ports = toml_array_in(conf, "ports"); if (ports) { int n = toml_array_nelem(ports); printf("Configured %d ports:\n", n); for (int i = 0; i < n; i++) { toml_datum_t port = toml_int_at(ports, i); if (port.ok) printf(" - %lld\n", port.u.i); } } // Output: Configured 3 ports: // - 8080 // - 8181 // - 8282 ``` -------------------------------- ### Retrieve Integer from TOML Source: https://context7.com/cktan/tomlc99/llms.txt Retrieves an integer value from a TOML table using a specified key. It returns a `toml_datum_t` structure. On success, `ok` is set to 1, and the integer value is stored as `int64_t` in `u.i`. Example usage shows retrieving 'max_connections' and 'timeout_ms'. ```c // Config: max_connections = 100 // timeout_ms = 30000 toml_datum_t max_conn = toml_int_in(conf, "max_connections"); toml_datum_t timeout = toml_int_in(conf, "timeout_ms"); if (max_conn.ok) printf("Max connections: %lld\n", max_conn.u.i); // Output: 100 if (timeout.ok) printf("Timeout: %lld ms\n", timeout.u.i); // Output: 30000 ``` -------------------------------- ### Retrieve Timestamp from TOML Source: https://context7.com/cktan/tomlc99/llms.txt Retrieves a timestamp value from a TOML table by key, returning a `toml_datum_t` with `ok=1` on success. The timestamp data must be freed after use. The example shows parsing various timestamp formats and printing date, time, and timezone components. ```c // Config: created = 1979-05-27T07:32:00Z // meeting = 1979-05-27T00:32:00-07:00 // birthday = 1979-05-27 // alarm = 07:32:00 toml_datum_t ts = toml_timestamp_in(conf, "created"); if (ts.ok) { if (ts.u.ts->year) printf("Date: %04d-%02d-%02d\n", *ts.u.ts->year, *ts.u.ts->month, *ts.u.ts->day); if (ts.u.ts->hour) printf("Time: %02d:%02d:%02d\n", *ts.u.ts->hour, *ts.u.ts->minute, *ts.u.ts->second); if (ts.u.ts->z) printf("Timezone: %s\n", ts.u.ts->z); free(ts.u.ts); // IMPORTANT: Free the timestamp after use } // Output: Date: 1979-05-27 // Time: 07:32:00 // Timezone: Z ``` -------------------------------- ### Get Key Name of TOML Table or Array (C) Source: https://context7.com/cktan/tomlc99/llms.txt Retrieves the key name associated with a TOML table or array. This function is helpful when traversing TOML structures and needing to identify the name of a specific nested element. ```c toml_table_t *server = toml_table_in(conf, "server"); const char *key = toml_table_key(server); printf("Table key: %s\n", key); // Output: server ``` -------------------------------- ### Retrieve Boolean from TOML Source: https://context7.com/cktan/tomlc99/llms.txt Retrieves a boolean value from a TOML table using a key. It returns a `toml_datum_t` with `ok=1` on success. The boolean value is stored as an integer (0 for false, 1 for true) in `u.b`. The example shows retrieving 'debug' and 'production' flags. ```c // Config: debug = true // production = false toml_datum_t debug = toml_bool_in(conf, "debug"); toml_datum_t prod = toml_bool_in(conf, "production"); if (debug.ok) printf("Debug mode: %s\n", debug.u.b ? "ON" : "OFF"); // Output: ON if (prod.ok) printf("Production: %s\n", prod.u.b ? "yes" : "no"); // Output: no ``` -------------------------------- ### Retrieve Nested Array from TOML Array Source: https://context7.com/cktan/tomlc99/llms.txt Retrieves a nested array from a TOML array at a specific index. It returns a pointer to `toml_array_t` if the element at the given index is itself an array, otherwise it returns NULL. The example demonstrates iterating through a 2D matrix. ```c // Config: matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] toml_array_t *matrix = toml_array_in(conf, "matrix"); if (matrix) { for (int i = 0; i < toml_array_nelem(matrix); i++) { toml_array_t *row = toml_array_at(matrix, i); if (row) { printf("Row %d: ", i); for (int j = 0; j < toml_array_nelem(row); j++) { toml_datum_t val = toml_int_at(row, j); if (val.ok) printf("%lld ", val.u.i); } printf("\n"); } } } // Output: Row 0: 1 2 3 // Row 1: 4 5 6 // Row 2: 7 8 9 ``` -------------------------------- ### Load Server Configuration from TOML File in C Source: https://context7.com/cktan/tomlc99/llms.txt Demonstrates how to parse a TOML file to load server configuration settings into a C struct. It handles required fields like 'host' and optional fields like 'ports', 'timeout', and 'ssl' settings. Error handling for file opening and parsing is included. Dependencies include standard C libraries and the toml.h header. ```c #include #include #include #include #include "toml.h" typedef struct { char *host; int64_t *ports; int port_count; int ssl_enabled; char *cert_path; double timeout; } server_config_t; void free_config(server_config_t *cfg) { if (cfg->host) free(cfg->host); if (cfg->ports) free(cfg->ports); if (cfg->cert_path) free(cfg->cert_path); } int load_config(const char *filename, server_config_t *cfg) { memset(cfg, 0, sizeof(*cfg)); FILE *fp = fopen(filename, "r"); if (!fp) { fprintf(stderr, "Cannot open %s: %s\n", filename, strerror(errno)); return -1; } char errbuf[200]; toml_table_t *conf = toml_parse_file(fp, errbuf, sizeof(errbuf)); fclose(fp); if (!conf) { fprintf(stderr, "Parse error: %s\n", errbuf); return -1; } // Get [server] table toml_table_t *server = toml_table_in(conf, "server"); if (!server) { fprintf(stderr, "Missing [server] section\n"); toml_free(conf); return -1; } // Extract host (required) toml_datum_t host = toml_string_in(server, "host"); if (!host.ok) { fprintf(stderr, "Missing server.host\n"); toml_free(conf); return -1; } cfg->host = host.u.s; // Transfer ownership // Extract ports array toml_array_t *ports = toml_array_in(server, "port"); if (ports) { cfg->port_count = toml_array_nelem(ports); cfg->ports = malloc(cfg->port_count * sizeof(int64_t)); for (int i = 0; i < cfg->port_count; i++) { toml_datum_t p = toml_int_at(ports, i); cfg->ports[i] = p.ok ? p.u.i : 0; } } // Extract timeout with default toml_datum_t timeout = toml_double_in(server, "timeout"); cfg->timeout = timeout.ok ? timeout.u.d : 30.0; // Get [server.ssl] table (optional) toml_table_t *ssl = toml_table_in(server, "ssl"); if (ssl) { toml_datum_t enabled = toml_bool_in(ssl, "enabled"); cfg->ssl_enabled = enabled.ok ? enabled.u.b : 0; toml_datum_t cert = toml_string_in(ssl, "cert"); if (cert.ok) cfg->cert_path = cert.u.s; } toml_free(conf); return 0; } int main() { server_config_t cfg; if (load_config("server.toml", &cfg) == 0) { printf("Server Configuration:\n"); printf(" Host: %s\n", cfg.host); printf(" Ports: "); for (int i = 0; i < cfg.port_count; i++) printf("%lld ", cfg.ports[i]); printf("\n"); printf(" Timeout: %.1f seconds\n", cfg.timeout); printf(" SSL: %s\n", cfg.ssl_enabled ? "enabled" : "disabled"); if (cfg.cert_path) printf(" Certificate: %s\n", cfg.cert_path); } free_config(&cfg); return 0; } // Example server.toml: // [server] // host = "www.example.com" // port = [8080, 8181, 8282] // timeout = 60.0 // // [server.ssl] // enabled = true // cert = "/etc/ssl/server.pem" // // Expected output: // Server Configuration: // Host: www.example.com // Ports: 8080 8181 8282 // Timeout: 60.0 seconds // SSL: enabled // Certificate: /etc/ssl/server.pem ``` -------------------------------- ### Test tomlc99 with toml-lang/toml-test suite Source: https://github.com/cktan/tomlc99/blob/master/README_old.md Details the steps to run the standard TOML test suite provided by toml-lang/toml-test against the tomlc99 library. This involves building the test suite and executing a script. ```sh # Build the library make # Navigate to the test directory cd test1 # Build the test suite (do this once) bash build.sh # Run the test suite bash run.sh ``` -------------------------------- ### Access TOML table content by key in C Source: https://github.com/cktan/tomlc99/blob/master/README_old.md Illustrates how to access TOML table values using string keys in C. It lists common functions for retrieving different data types and accessing tables and arrays by key. ```c toml_string_in(tab, key); toml_bool_in(tab, key); toml_int_in(tab, key); toml_double_in(tab, key); toml_timestamp_in(tab, key); toml_table_in(tab, key); toml_array_in(tab, key); ``` -------------------------------- ### Parse TOML from File using C99 Source: https://context7.com/cktan/tomlc99/llms.txt Parses a TOML configuration from a file pointer using `toml_parse_file`. Returns the root table on success or NULL on failure. The caller must free the returned table using `toml_free`. ```c #include #include #include #include #include "toml.h" int main() { FILE *fp = fopen("config.toml", "r"); if (!fp) { fprintf(stderr, "Cannot open file: %s\n", strerror(errno)); return 1; } char errbuf[200]; toml_table_t *conf = toml_parse_file(fp, errbuf, sizeof(errbuf)); fclose(fp); if (!conf) { fprintf(stderr, "Parse error: %s\n", errbuf); return 1; } // Use configuration... printf("Configuration loaded successfully\n"); toml_free(conf); return 0; } ``` -------------------------------- ### Iterate through TOML table keys in C Source: https://github.com/cktan/tomlc99/blob/master/README_old.md Shows how to iterate over the keys within a TOML table using an integer index in C. This is useful when the exact keys are not known beforehand. ```c toml_table_t* tab = toml_parse_file(...); for (int i = 0; ; i++) { const char* key = toml_key_in(tab, i); if (!key) break; printf("key %d: %s\n", i, key); } ``` -------------------------------- ### Test tomlc99 with iarna/toml-spec-tests suite Source: https://github.com/cktan/tomlc99/blob/master/README_old.md Outlines the procedure for testing tomlc99 against the TOML specification tests from iarna/toml-spec-tests. Similar to the other test suite, it requires building and running scripts. ```sh # Build the library make # Navigate to the test directory cd test2 # Build the test suite (do this once) bash build.sh # Run the test suite bash run.sh ``` -------------------------------- ### Set Custom Memory Allocation Functions (C) Source: https://context7.com/cktan/tomlc99/llms.txt Allows the TOML C library to use custom memory allocation and deallocation functions (e.g., `my_malloc`, `my_free`). This must be called before any parsing functions are invoked and is useful for memory tracking or custom allocators. ```c #include void *my_malloc(size_t size) { void *ptr = malloc(size); printf("Allocated %zu bytes at %p\n", size, ptr); return ptr; } void my_free(void *ptr) { printf("Freeing %p\n", ptr); free(ptr); } int main() { toml_set_memutil(my_malloc, my_free); // Now all allocations use custom functions toml_table_t *conf = toml_parse_file(fp, errbuf, sizeof(errbuf)); // ... toml_free(conf); return 0; } ``` -------------------------------- ### Parse TOML from String using C99 Source: https://context7.com/cktan/tomlc99/llms.txt Parses a TOML configuration from a NUL-terminated string using `toml_parse`. Returns the root table on success or NULL on failure. The caller must free the returned table using `toml_free`. ```c #include #include #include "toml.h" int main() { char config[] = "[database]\n" "host = \"localhost\"\n" "port = 5432\n" "enabled = true\n"; char errbuf[200]; toml_table_t *conf = toml_parse(config, errbuf, sizeof(errbuf)); if (!conf) { fprintf(stderr, "Parse error: %s\n", errbuf); return 1; } toml_table_t *db = toml_table_in(conf, "database"); if (db) { toml_datum_t host = toml_string_in(db, "host"); toml_datum_t port = toml_int_in(db, "port"); toml_datum_t enabled = toml_bool_in(db, "enabled"); if (host.ok) { printf("Host: %s\n", host.u.s); // Output: Host: localhost free(host.u.s); } if (port.ok) { printf("Port: %lld\n", port.u.i); // Output: Port: 5432 } if (enabled.ok) { printf("Enabled: %s\n", enabled.u.b ? "true" : "false"); // Output: Enabled: true } } toml_free(conf); return 0; } ``` -------------------------------- ### Count Elements in a TOML Table (C) Source: https://context7.com/cktan/tomlc99/llms.txt Provides counts for different types of elements within a TOML table: the number of key-value pairs, the number of arrays, and the number of sub-tables. This is useful for analyzing the structure and complexity of a TOML configuration. ```c toml_table_t *conf = toml_parse_file(fp, errbuf, sizeof(errbuf)); int nkval = toml_table_nkval(conf); // Number of key-value pairs int narr = toml_table_narr(conf); // Number of arrays int ntab = toml_table_ntab(conf); // Number of sub-tables printf("Table contains:\n"); printf(" %d key-value pairs\n", nkval); printf(" %d arrays\n", narr); printf(" %d sub-tables\n", ntab); ``` -------------------------------- ### Parse TOML file and extract values in C Source: https://github.com/cktan/tomlc99/blob/master/README_old.md Demonstrates parsing a TOML file, accessing nested table values (string and array of integers), and freeing allocated memory. It includes error handling for file operations and parsing. ```c #include #include #include #include #include "toml.h" static void error(const char* msg, const char* msg1) { fprintf(stderr, "ERROR: %s%s\n", msg, msg1?msg1:""); exit(1); } int main() { FILE* fp; char errbuf[200]; // 1. Read and parse toml file fp = fopen("sample.toml", "r"); if (!fp) { error("cannot open sample.toml - ", strerror(errno)); } toml_table_t* conf = toml_parse_file(fp, errbuf, sizeof(errbuf)); fclose(fp); if (!conf) { error("cannot parse - ", errbuf); } // 2. Traverse to a table. toml_table_t* server = toml_table_in(conf, "server"); if (!server) { error("missing [server]", ""); } // 3. Extract values toml_datum_t host = toml_string_in(server, "host"); if (!host.ok) { error("cannot read server.host", ""); } toml_array_t* portarray = toml_array_in(server, "port"); if (!portarray) { error("cannot read server.port", ""); } printf("host: %s\n", host.u.s); printf("port: "); for (int i = 0; ; i++) { toml_datum_t port = toml_int_at(portarray, i); if (!port.ok) break; printf("%d ", (int)port.u.i); } printf("\n"); // 4. Free memory free(host.u.s); toml_free(conf); return 0; } ``` -------------------------------- ### Convert Between UTF-8 and UCS Encodings (C) Source: https://context7.com/cktan/tomlc99/llms.txt Provides functions to convert character strings between UTF-8 and UCS (Unicode) encodings. `toml_utf8_to_ucs` converts a UTF-8 string to a Unicode codepoint, while `toml_ucs_to_utf8` converts a codepoint back to a UTF-8 string. ```c // UTF-8 to UCS int64_t codepoint; const char *utf8 = "é"; int bytes_read = toml_utf8_to_ucs(utf8, strlen(utf8), &codepoint); printf("Codepoint: U+%04llX\n", codepoint); // Output: U+00E9 // UCS to UTF-8 char buf[6]; int bytes_written = toml_ucs_to_utf8(0x00E9, buf); buf[bytes_written] = '\0'; printf("UTF-8: %s\n", buf); // Output: é ``` -------------------------------- ### Check TOML Key Existence using C99 Source: https://context7.com/cktan/tomlc99/llms.txt Checks if a specific key exists within a TOML table using `toml_key_exists`. Returns 1 if the key is found, and 0 otherwise. This is useful for conditional logic based on configuration presence. ```c if (toml_key_exists(conf, "database")) { printf("Database configuration found\n"); toml_table_t *db = toml_table_in(conf, "database"); // ... } ``` -------------------------------- ### Access Array Elements by Index Source: https://context7.com/cktan/tomlc99/llms.txt Provides functions to retrieve specific elements from a TOML array by their index. Supported types include strings, integers, doubles, booleans, and timestamps. Each function returns a `toml_datum_t` with `ok=1` on success. String elements must be freed after use. ```c // Config: names = ["Alice", "Bob", "Charlie"] // scores = [95.5, 87.3, 92.1] // flags = [true, false, true] toml_array_t *names = toml_array_in(conf, "names"); toml_array_t *scores = toml_array_in(conf, "scores"); toml_array_t *flags = toml_array_in(conf, "flags"); // String array for (int i = 0; i < toml_array_nelem(names); i++) { toml_datum_t name = toml_string_at(names, i); if (name.ok) { printf("Name: %s\n", name.u.s); free(name.u.s); // Free each string } } // Double array for (int i = 0; i < toml_array_nelem(scores); i++) { toml_datum_t score = toml_double_at(scores, i); if (score.ok) printf("Score: %.1f\n", score.u.d); } // Boolean array for (int i = 0; i < toml_array_nelem(flags); i++) { toml_datum_t flag = toml_bool_at(flags, i); if (flag.ok) printf("Flag: %s\n", flag.u.b ? "true" : "false"); } ``` -------------------------------- ### Handle toml_datum_t structure in C Source: https://github.com/cktan/tomlc99/blob/master/README_old.md Explains the usage of the `toml_datum_t` structure returned by some `toml_*_at` and `toml_*_in` functions. It highlights the `ok` flag for success checking and the need to free memory for string and timestamp types. ```c toml_datum_t host = toml_string_in(tab, "host"); if (host.ok) { printf("host: %s\n", host.u.s); free(host.u.s); /* FREE applies to string and timestamp types only */ } ``` -------------------------------- ### Iterate TOML Table Keys using C99 Source: https://context7.com/cktan/tomlc99/llms.txt Retrieves the key name at a specific index within a TOML table using `toml_key_in`. Returns NULL if the index is out of range. This function allows iteration over all keys present in a table. ```c // Iterate over all keys in a table toml_table_t *conf = toml_parse_file(fp, errbuf, sizeof(errbuf)); for (int i = 0; ; i++) { const char *key = toml_key_in(conf, i); if (!key) break; printf("Key %d: %s\n", i, key); } ``` -------------------------------- ### Access Nested TOML Table using C99 Source: https://context7.com/cktan/tomlc99/llms.txt Retrieves a nested TOML table from a parent table using a string key with `toml_table_in`. Returns NULL if the key does not exist or is not a table. This is useful for navigating hierarchical TOML structures. ```c // Config: [server] // [server.ssl] // enabled = true // cert = "/path/to/cert.pem" toml_table_t *server = toml_table_in(conf, "server"); if (server) { toml_table_t *ssl = toml_table_in(server, "ssl"); if (ssl) { toml_datum_t enabled = toml_bool_in(ssl, "enabled"); toml_datum_t cert = toml_string_in(ssl, "cert"); if (enabled.ok) printf("SSL enabled: %s\n", enabled.u.b ? "yes" : "no"); if (cert.ok) { printf("Certificate: %s\n", cert.u.s); free(cert.u.s); } } } ``` -------------------------------- ### Access TOML Table from Array by Index (C) Source: https://context7.com/cktan/tomlc99/llms.txt Retrieves a specific TOML table from an array of tables using its index. Returns NULL if the index is out of bounds or the element is not a table. This is useful for iterating through structured data within a TOML file. ```c // Config: [[products]] // name = "Hammer" // sku = 738594937 // // [[products]] // name = "Nail" // sku = 284758393 // color = "gray" toml_array_t *products = toml_array_in(conf, "products"); if (products) { for (int i = 0; i < toml_array_nelem(products); i++) { toml_table_t *product = toml_table_at(products, i); if (product) { toml_datum_t name = toml_string_in(product, "name"); toml_datum_t sku = toml_int_in(product, "sku"); toml_datum_t color = toml_string_in(product, "color"); printf("Product %d:\n", i + 1); if (name.ok) { printf(" Name: %s\n", name.u.s); free(name.u.s); } if (sku.ok) printf(" SKU: %lld\n", sku.u.i); if (color.ok) { printf(" Color: %s\n", color.u.s); free(color.u.s); } } } } // Output: Product 1: // Name: Hammer // SKU: 738594937 // Product 2: // Name: Nail // SKU: 284758393 // Color: gray ``` -------------------------------- ### Free Parsed TOML Table using C99 Source: https://context7.com/cktan/tomlc99/llms.txt Frees the memory allocated for a TOML table obtained from `toml_parse()` or `toml_parse_file()`. After calling this, any handles accessed through the table become invalid. ```c toml_table_t *conf = toml_parse_file(fp, errbuf, sizeof(errbuf)); // ... use configuration ... toml_free(conf); // All subtables, arrays, and handles are now invalid ``` -------------------------------- ### Extract TOML String Value using C99 Source: https://context7.com/cktan/tomlc99/llms.txt Retrieves a string value from a TOML table by its key using `toml_string_in`. Returns a `toml_datum_t` with `ok=1` on success. The extracted string must be freed by the caller using `free()` after use. ```c // Config: name = "John Doe" toml_datum_t name = toml_string_in(conf, "name"); if (name.ok) { printf("Name: %s\n", name.u.s); // Output: Name: John Doe free(name.u.s); // IMPORTANT: Free the string after use } ``` -------------------------------- ### Determine TOML Array Element Kind (C) Source: https://context7.com/cktan/tomlc99/llms.txt Identifies the type of elements contained within a TOML array. It can distinguish between arrays of tables ('t'), arrays of arrays ('a'), arrays of values ('v'), or mixed types ('m'). This helps in understanding the structure of nested TOML data. ```c toml_array_t *arr = toml_array_in(conf, "data"); char kind = toml_array_kind(arr); switch (kind) { case 't': printf("Array of tables\n"); break; case 'a': printf("Array of arrays\n"); break; case 'v': printf("Array of values\n"); break; case 'm': printf("Mixed array\n"); break; } ``` -------------------------------- ### Determine TOML Value Array Element Type (C) Source: https://context7.com/cktan/tomlc99/llms.txt For TOML arrays containing only values, this function returns the specific data type of those values. Supported types include integers ('i'), doubles ('d'), booleans ('b'), strings ('s'), time ('t'), date ('D'), timestamp ('T'), or mixed ('m'). Returns 0 if the type is unknown. ```c toml_array_t *arr = toml_array_in(conf, "numbers"); if (toml_array_kind(arr) == 'v') { char type = toml_array_type(arr); printf("Value type: %c\n", type); // Output: i (for integer array) } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.