summaryrefslogtreecommitdiffhomepage
path: root/examples/demos.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-03-04 13:18:35 +0100
committerTyge Løvset <[email protected]>2022-03-04 13:18:35 +0100
commit3c379fbfb2b7301cd5c4f5371a9f0b96a1369b60 (patch)
tree46975c8374107e44fd9605894ce5b02d981ba538 /examples/demos.c
parentc4301c6b492bb962a943335bf8df4920b2a699cf (diff)
downloadSTC-modified-3c379fbfb2b7301cd5c4f5371a9f0b96a1369b60.tar.gz
STC-modified-3c379fbfb2b7301cd5c4f5371a9f0b96a1369b60.zip
Updated printf formatting to portable code. This was also to use http://winlibs.com gcc+clang with ucrt runtime-libs without warnings.
Diffstat (limited to 'examples/demos.c')
-rw-r--r--examples/demos.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/demos.c b/examples/demos.c
index 93192ee5..e91be28a 100644
--- a/examples/demos.c
+++ b/examples/demos.c
@@ -41,14 +41,14 @@ void vectordemo1()
for (size_t i = 10; i <= 100; i += 10)
cvec_ix_push_back(&bignums, i * i);
- printf("erase - %d: %zu\n", 3, bignums.data[3]);
+ printf("erase - %d: %" PRIuMAX "\n", 3, bignums.data[3]);
cvec_ix_erase_n(&bignums, 3, 1); // erase index 3
cvec_ix_pop_back(&bignums); // erase the last
cvec_ix_erase_n(&bignums, 0, 1); // erase the first
for (size_t i = 0; i < cvec_ix_size(bignums); ++i) {
- printf("%zu: %zu\n", i, bignums.data[i]);
+ printf("%" PRIuMAX ": %" PRIuMAX "\n", i, bignums.data[i]);
}
}
}
@@ -174,11 +174,11 @@ void mapdemo3()
cmap_str_iter it = cmap_str_find(&table, "Make");
c_foreach (i, cmap_str, table)
printf("entry: %s: %s\n", i.ref->first.str, i.ref->second.str);
- printf("size %zu: remove: Make: %s\n", cmap_str_size(table), it.ref->second.str);
+ printf("size %" PRIuMAX ": remove: Make: %s\n", cmap_str_size(table), it.ref->second.str);
//cmap_str_erase(&table, "Make");
cmap_str_erase_at(&table, it);
- printf("size %zu\n", cmap_str_size(table));
+ printf("size %" PRIuMAX "\n", cmap_str_size(table));
c_foreach (i, cmap_str, table)
printf("entry: %s: %s\n", i.ref->first.str, i.ref->second.str);
cmap_str_drop(&table); // frees key and value cstrs, and hash table.
@@ -198,7 +198,7 @@ void arraydemo1()
float **arr2 = arr3.data[5];
float *arr1 = arr3.data[5][4];
- printf("arr3: %zu: (%zu, %zu, %zu) = %zu\n", sizeof(arr3),
+ printf("arr3: %" PRIuMAX ": (%" PRIuMAX ", %" PRIuMAX ", %" PRIuMAX ") = %" PRIuMAX "\n", sizeof(arr3),
arr3.xdim, arr3.ydim, arr3.zdim, carr3_f_size(arr3));
printf("%g\n", arr1[3]); // = 10.2