Skip to content

Commit 7503aa6

Browse files
author
Garett Bass
committed
updated README.md
1 parent 6ad32a5 commit 7503aa6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
A simple std::vector-style array for C
33

44
```C
5-
int* a = NULL;
5+
array_t(int) a = array_null;
66

77
// allocate array 'a' with capacity of int[16], and no destructor callback
88
array_alloc(a, 16, NULL);
99

1010
array_append(a) = 1; // append to the array, and assign 1 to the appended integer
1111

12-
a[0] = 2; // change the value of a[0] from 1 to 2
12+
array(a)[0] = 2; // change the value at index 0 from 1 to 2
1313

1414
array_remove(a, 0); // remove integer at index 0
1515

@@ -27,7 +27,7 @@ puts("\n");
2727

2828
// pointer-based iteration
2929
const int* const end = array_end(a);
30-
for (int* itr = a; itr < end; ++itr) {
30+
for (int* itr = array_begin(a); itr < end; ++itr) {
3131
printf("%i, ", *itr);
3232
}
3333
puts("\n");

0 commit comments

Comments
 (0)