Miscellany
public text v1 · immutable/* I can't code C for shit ^^ */
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
int *data;
} array;
main()
{
array arr;
char txt[]="Test";
array_grow(arr, &txt);
printf("%d\n", arr.data[0]);
}
int array_grow(array arr, int value)
{
if ((arr.data = malloc(sizeof(value))) == NULL) {
exit(1);
}
arr.data[0] = value;
}