source:
CIVL/mods/dev.civl.com/examples/opencl/2.15/simplemallocs.cvl@
bc0fbae
| Last change on this file since bc0fbae was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 378 bytes | |
| Line | |
|---|---|
| 1 | #include "cl.cvl" |
| 2 | #include <stdio.h> |
| 3 | #include <stdlib.h> |
| 4 | #include <string.h> |
| 5 | #include <civlc.h> |
| 6 | |
| 7 | int main(int argc, char** argv) |
| 8 | { |
| 9 | void * array[3]; |
| 10 | |
| 11 | int star = 1; |
| 12 | |
| 13 | for (int i = 0; i < 3; i++) |
| 14 | { |
| 15 | array[i] = (int*)malloc(sizeof(int)); |
| 16 | memcpy(array[i], &star, sizeof(int)); |
| 17 | |
| 18 | } |
| 19 | |
| 20 | for (int i = 0; i < 3; i++) |
| 21 | { |
| 22 | free(array[i]); |
| 23 | |
| 24 | } |
| 25 | |
| 26 | return 0; |
| 27 | } |
Note:
See TracBrowser
for help on using the repository browser.
