feat: add array-dim2

This commit is contained in:
dancingCycle 2023-01-11 13:22:36 +01:00
parent 0c236825c3
commit 1ea03141b4
3 changed files with 76 additions and 0 deletions

35
array-dim2/main.c Normal file
View File

@ -0,0 +1,35 @@
#include <jansson.h>
int main(int argc, char *argv[]) {
fprintf(stdout,"main() Started...\n");
json_t *arrayArray, *arrayInt, *integer1, *integer2;
size_t sizeArAr, sizeArInt;
arrayInt = json_array();
integer1 = json_integer(42);
integer2 = json_integer(23);
json_array_append(arrayInt, integer1);
json_array_append(arrayInt, integer2);
json_decref(integer1);
json_decref(integer2);
sizeArInt = json_array_size(arrayInt);
fprintf(stdout,"main() size(arrayInt): %ld\n", sizeArInt);
arrayArray = json_array();
json_array_append(arrayArray, arrayInt);
json_decref(arrayInt);
sizeArAr = json_array_size(arrayArray);
fprintf(stdout,"main() size(arrayArray): %ld\n", sizeArAr);
fprintf(stdout,"main() Done.\n");
return 0;
}

24
array-dim2/makefile Normal file
View File

@ -0,0 +1,24 @@
# Docu
#
#$@ is the name of the file to be made
#$? is the names of the changed dependents
#$< the name of the related file that caused the action
#$* the prefix shared by target and dependent files
#
# Others
RM = /bin/rm -f
#
# Source, Executable, Includes, Library Defines
EXE = main
#
# Compiler, Linker Defines
CC = /usr/bin/gcc
#
all: main.o
$(CC) main.c -L/usr/lib/x86_64-linux-gnu -ljansson -Wall -o $(EXE)
#
main.o:
$(CC) -c main.c
# Clean Up Objects, Exectuables, Dumps out of source directory
clean:
$(RM) *.o $(EXE) *~

17
array-dim2/readme.md Normal file
View File

@ -0,0 +1,17 @@
* build
```
make clean all
```
* cleanup
```
make clean
```
* run
```
./main
```