1+++ 2title = "Calling it from C" 3description = "" 4weight = 30 5+++ 6 7Firstly we need to declare to C our `result` returning C++ function: 8 9{{% snippet "c_api.c" "preamble" %}} 10 11Now let's call the C++ function from C: 12 13{{% snippet "c_api.c" "example" %}} 14 15Running this C program yields: 16 17``` 18to_string(9) fills buffer with '9' of 1 characters 19to_string(99) fills buffer with '99' of 2 characters 20to_string(999) fills buffer with '999' of 3 characters 21to_string(9999) failed with error code 105 (No buffer space available) 22``` 23