Skip to content

Commit d7ea997

Browse files
author
fmeng
committed
remove malloc.cpp and change to malloc.c
1 parent 7caafb5 commit d7ea997

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

examples/helloworld/main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ import (
99
func main() {
1010
name := flag.String("name", "world", "specify the name you want to say hi")
1111
flag.Parse()
12+
fmt.Printf("%d\n", *name)
1213
fmt.Println("os args is:", os.Args)
1314
fmt.Println("input parameter is:", *name)
14-
fmt.Printf("Hello %s from Go\n", *name)
15+
fullString := fmt.Sprintf("Hello %s from Go\n", *name)
16+
fmt.Println(fullString)
17+
for i, c := range fullString {
18+
fmt.Printf("%d:%s ", i, string(c))
19+
}
20+
1521
}

examples/malloc/malloc.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <stdlib.h>
2+
#include <stdio.h>
3+
#include <string.h>
4+
5+
#define BLOCK_SIZE (100*1024*1024)
6+
char* allocMemory() {
7+
char* out = (char*)malloc(BLOCK_SIZE);
8+
memset(out, 'A', BLOCK_SIZE);
9+
return out;
10+
}

examples/malloc/malloc.cpp

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)