...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <stdlib.h>
#include <string.h>
void func(void) {
size_t resize = 1024;
size_t alignment = 1 << 12;
int *ptr;
int *ptr1;
if ((ptr = aligned_alloc(alignment, sizeof(int))) == NULL) {
/* Handle error */
}
if ((ptr1 = aligned_alloc(alignment, resize)) == NULL) {
/* Handle error */
}
if ((memcpy(ptr1, ptr, sizeof(int)) == NULL) {
/* Handle error */
}
free(ptr);
} |
...