Skip to content

Commit

Permalink
README: Add note about needing to free print results in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
FSMaxB committed Dec 3, 2018
1 parent 2c914c0 commit cb1df2f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ In this example we want to build and parse the following JSON:
Let's build the above JSON and print it to a string:
```c
//create a monitor with a list of supported resolutions
//NOTE: Returns a heap allocated string, you are required to free it after use.
char* create_monitor(void)
{
const unsigned int resolution_numbers[3][2] = {
Expand Down Expand Up @@ -373,6 +374,7 @@ end:
Alternatively we can use the `cJSON_Add...ToObject` helper functions to make our lifes a little easier:
```c
//NOTE: Returns a heap allocated string, you are required to free it after use.
char *create_monitor_with_helpers(void)
{
const unsigned int resolution_numbers[3][2] = {
Expand Down

0 comments on commit cb1df2f

Please sign in to comment.