We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6ad32a5 commit 7503aa6Copy full SHA for 7503aa6
README.md
@@ -2,14 +2,14 @@
2
A simple std::vector-style array for C
3
4
```C
5
-int* a = NULL;
+array_t(int) a = array_null;
6
7
// allocate array 'a' with capacity of int[16], and no destructor callback
8
array_alloc(a, 16, NULL);
9
10
array_append(a) = 1; // append to the array, and assign 1 to the appended integer
11
12
-a[0] = 2; // change the value of a[0] from 1 to 2
+array(a)[0] = 2; // change the value at index 0 from 1 to 2
13
14
array_remove(a, 0); // remove integer at index 0
15
@@ -27,7 +27,7 @@ puts("\n");
27
28
// pointer-based iteration
29
const int* const end = array_end(a);
30
-for (int* itr = a; itr < end; ++itr) {
+for (int* itr = array_begin(a); itr < end; ++itr) {
31
printf("%i, ", *itr);
32
}
33
puts("\n");
0 commit comments