/nobber/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/nobber/trunk

« back to all changes in this revision

Viewing changes to src/main.c

  • Committer: Stream
  • Date: 2025-10-12 11:00:06 UTC
  • Revision ID: streamer@octo-20251012110006-ge4khc8giu3dpbda
Initial Commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdlib.h>
 
2
#include <stddef.h>
 
3
#include <stdio.h>
 
4
#include <inttypes.h>
 
5
#include <stdint.h>
 
6
#define NOB_IMPLEMENTATION
 
7
#include "../nob.h"
 
8
 
 
9
 
 
10
typedef struct {
 
11
    int32_t something;
 
12
    char * something_else;
 
13
} Foo;
 
14
 
 
15
typedef struct {
 
16
    int32_t * items;
 
17
    size_t count;
 
18
    size_t capacity;
 
19
} DaInt;
 
20
 
 
21
typedef struct {
 
22
    Foo ** items;
 
23
    size_t count;
 
24
    size_t capacity;
 
25
} DaFoo;
 
26
 
 
27
int main ([[maybe_unused]] int argc,[[maybe_unused]] char * argv[]) {
 
28
//    DaFoo * foo_list = malloc (sizeof (DaFoo));
 
29
//    for (int i = 0; i <= 1000; i++) {
 
30
//        Foo * f = malloc (sizeof (Foo));
 
31
//        f->something = i;
 
32
//        f->something_else = malloc (4);
 
33
//        sprintf (f->something_else, "%i", i);
 
34
//        nob_da_append (foo_list, f);
 
35
//    }
 
36
//
 
37
//    nob_da_foreach (Foo *, it, foo_list) {
 
38
//        fprintf (stdout, "something: %i, somethig_else: %s\n", (*it)->something, (*it)->something_else);
 
39
//    }
 
40
 
 
41
 
 
42
    DaInt * int_list = malloc (sizeof (DaInt));
 
43
    for (int32_t i = 0; i <= 1000; i++) {
 
44
        nob_da_append (int_list, i);
 
45
    }
 
46
 
 
47
    nob_da_foreach (int32_t , it, int_list) {
 
48
        auto i = *it;
 
49
        fprintf (stdout,"%"PRIi32"\n", i);
 
50
    }
 
51
}
 
52
 
 
53