feat: add calltoc
This commit is contained in:
30
__ffi/calltoc/myc.c
Normal file
30
__ffi/calltoc/myc.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
char* hello() {
|
||||
char* ptr = (char*)malloc(13);
|
||||
if (ptr == NULL) {
|
||||
return ptr;
|
||||
}
|
||||
ptr[0] = 'H';
|
||||
ptr[1] = 'e';
|
||||
ptr[2] = 'l';
|
||||
ptr[3] = 'l';
|
||||
ptr[4] = 'o';
|
||||
ptr[5] = ' ';
|
||||
ptr[6] = 'w';
|
||||
ptr[7] = 'o';
|
||||
ptr[8] = 'r';
|
||||
ptr[9] = 'l';
|
||||
ptr[10] = 'd';
|
||||
ptr[11] = '!';
|
||||
ptr[12] = '\0';
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void goodbye(char* ptr) {
|
||||
if (ptr != NULL) {
|
||||
free(ptr);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user