diff --git a/example-01.c b/example-01.c index b1d96b6..e4f5049 100644 --- a/example-01.c +++ b/example-01.c @@ -29,7 +29,7 @@ /* Parser a json string. */ int main( void ) { - char const* msg = "{\n" + char str[] = "{\n" "\t\"firstName\": \"Bidhan\",\n" "\t\"lastName\": \"Chatterjee\",\n" "\t\"age\": 40,\n" @@ -44,11 +44,9 @@ int main( void ) { "\t\t{ \"type\": \"fax\", \"number\": \"91-342-2567692\" }\n" "\t]\n" "}\n"; - char aux[512]; - strcpy( aux, msg ); - puts( aux ); + puts( str ); json_t mem[32]; - json_t const* json = json_create( aux, mem, sizeof mem / sizeof *mem ); + json_t const* json = json_create( str, mem, sizeof mem / sizeof *mem ); if ( !json ) { puts("Error json create."); return EXIT_FAILURE; diff --git a/example-02.c b/example-02.c index 3589e33..9861771 100644 --- a/example-02.c +++ b/example-02.c @@ -86,7 +86,7 @@ static void print( json_t const* json ) { /* Parser a json string. */ int main( void ) { - char const* msg = "{\n" + char str[] = "{\n" "\t\"firstName\": \"Bidhan\",\n" "\t\"lastName\": \"Chatterjee\",\n" "\t\"age\": 40,\n" @@ -101,11 +101,9 @@ int main( void ) { "\t\t{ \"type\": \"fax\", \"number\": \"91-342-2567692\" }\n" "\t]\n" "}\n"; - char aux[512]; - strcpy( aux, msg ); - puts( aux ); + puts( str ); json_t mem[32]; - json_t const* json = json_create( aux, mem, sizeof mem / sizeof *mem ); + json_t const* json = json_create( str, mem, sizeof mem / sizeof *mem ); if ( !json ) { puts("Error json create."); return EXIT_FAILURE;