malloc
English · noun; verb
Examples, page 1
- Dynamic memory allocation is performed using pointers; the result of a malloc is usually cast to the data type of the data to be stored. — Wikipedia: C (programming language) (Wikipedia contributors). Licence: cc-by-sa-4.0. — an example found by Mova's corpus index (cc-by-sa-4.0)
- However, it is also possible to allocate a block of memory (of arbitrary size) at run time, using the standard library's malloc function, and treat it as an array. — Wikipedia: C (programming language) (Wikipedia contributors). Licence: cc-by-sa-4.0. — an example found by Mova's corpus index (cc-by-sa-4.0)
- Dynamic memory allocation is performed using pointers; the result of a malloc is usually cast to the data type of the data to be stored. — Wikipedia: C (programming language) (Wikipedia contributors). Licence: cc-by-sa-4.0. — Mova's open texts (cc-by-sa-4.0)
- However, it is also possible to allocate a block of memory (of arbitrary size) at run time, using the standard library's malloc function, and treat it as an array. — Wikipedia: C (programming language) (Wikipedia contributors). Licence: cc-by-sa-4.0. — Mova's open texts (cc-by-sa-4.0)
- int func(int n, int m) { float (*p)[n][m] = malloc(sizeof *p); if (p == NULL) { return -1; } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { (*p)[i][j] = i + j; } } print_array(n, m, p); free(p); return 1; } And here is a similar implementation using C99's Auto VLA feature: — Wikipedia: C (programming language) (Wikipedia contributors). Licence: cc-by-sa-4.0. — Mova's open texts (cc-by-sa-4.0)
This page in Markdown https://md.dictionary.elamur.ai/free/en/english/malloc/examples/1/