Aufgaben-Python/courses/cpp/03_arrays_strings_und_manuelle_speicherallokation/musterloesung.c

14 lines
No EOL
267 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int* erstelle_dynamisches_array(size_t groesse) {
int* arr = (int*)malloc(groesse * sizeof(int));
return arr;
}
void speicher_freigeben(void* ptr) {
if (ptr != NULL) {
free(ptr);
}
}