1 // Copyright 2022 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 /* 8 #include <stdlib.h> 9 #include <stdio.h> 10 11 int test(int *a) { 12 a[2] = 300; // BOOM 13 return a[2]; 14 } 15 */ 16 import "C" 17 18 import "fmt" 19 20 var cIntArray [2]C.int 21 22 func main() { 23 r := C.test(&cIntArray[0]) 24 fmt.Println("r value = ", r) 25 } 26