Skip to content

Commit 2fc3516

Browse files
committed
Print the heap address in chello
1 parent 9590757 commit 2fc3516

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

samples/chello/chello.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ const NeotronApi *g_api;
1515
int app_entry(const NeotronApi *f, size_t argc, const FfiString* argv) {
1616
g_api = f;
1717
// allocate a buffer
18-
void *buffer = calloc(1024, 1);
18+
char *buffer = (char*) calloc(1024, 1);
1919
// write a string into it
20-
snprintf(buffer, 1023, "Hello, world!\n");
20+
snprintf(buffer, 1023, "Hello, world!");
2121
// print the buffer
22-
printf(buffer);
22+
printf("Buffer %p contains: '%s'\n", buffer, buffer);
2323
// free the buffer
2424
free(buffer);
2525
for(size_t i = 0; i < argc; i++) {

0 commit comments

Comments
 (0)