#include <stdio.h>
#include <stdlib.h>
int main(void) {
int *buf = malloc(3 * sizeof *buf);
for (int i = 0; i < 3; i++) {
buf[i] = i * i;
}
printf("%d %d %d\n", buf[0], buf[1], buf[2]);
free(buf);
return 0;
}malloc gives a pointer you must free