Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
tadd committed Sep 20, 2024
1 parent bca3e1e commit 1a3dea7
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
libscary: An (scary) scalable array library in C
================================================

```c
int *a = scary_new(sizeof(int));
```
See the LHS; it looks like an ordinary C array, but

```c
printf("length: %zd\n", scary_length(a));
```
they knows their length by themselves.
```c
scary_push(a, -1);
scary_push(a, 42);
```
You can push elements with automatic memory extension,
as much as you want.

```c
int i = a[1];
```
And you'll see magic here; You can access them as an ordinary
C array without any overhead.

```c
printf("content: %d\n", i);
```
Then it prints 42. Happy ending.

0 comments on commit 1a3dea7

Please sign in to comment.