@@ -55,43 +55,43 @@ char *indexStringInString(const char *string, int length, const char *target) {
5555 }
5656 return ret ;
5757}
58- int main () {
59- char a [] = "heollo.xyz" ;
60- // printf("%d", indexCharInString(a, strlen(a), '.'));
61- // printf("%s", a + indexStringInString(a, strlen(a), "o."));
62- // printf("%s", indexStringInString(a, strlen(a), "o."));
63- // puts(indexStringInString(a, strlen(a), "o."));
64- puts (strstr (a , "o." ));
65- }
6658// int main() {
67- // const char json[] =
68- // "{\"int1\":1,\"str1\":\"2\",\"double1\":3.14,\"bool1\":true,"
69- // "\"char1\":48,\"null1\":null,\"array1\":[\"string\",1,null,"
70- // "true,false,3.14],\"json1\":{\"id\":0,\"status\":200}}";
71- // puts(json);
72- // struct json1 {
73- // int int1;
74- // char *str1;
75- // double double1;
76- // _Bool bool1;
77- // char char1;
78- // void *null1;
79- // void **array1;
80- // struct json1 *next;
81- // };
82- // int strindex = 0;
83- // jumpNULL(json, &strindex);
84- // if (json[strindex] != '{') {
85- // printf("json parse failed");
86- // } else {
87- // strindex++;
88- // jumpNULL(json, &strindex);
89- // if (json[strindex] != '"') {
90- // { jumpNULL(json, &strindex); }
91- // }
92- // if (json[strindex] != '"') {
93- // printf("json parse failed");
94- // } else {
95- // }
96- // }
97- // }
59+ // char a[] = "heollo.xyz";
60+ // // printf("%d", indexCharInString(a, strlen(a), '.'));
61+ // // printf("%s", a + indexStringInString(a, strlen(a), "o."));
62+ // // printf("%s", indexStringInString(a, strlen(a), "o."));
63+ // // puts(indexStringInString(a, strlen(a), "o."));
64+ // puts(strstr(a, "o."));
65+ // }
66+ int main () {
67+ const char json [] =
68+ "{\"int1\":1,\"str1\":\"2\",\"double1\":3.14,\"bool1\":true,"
69+ "\"char1\":48,\"null1\":null,\"array1\":[\"string\",1,null,"
70+ "true,false,3.14],\"json1\":{\"id\":0,\"status\":200}}" ;
71+ puts (json );
72+ struct json1 {
73+ int int1 ;
74+ char * str1 ;
75+ double double1 ;
76+ _Bool bool1 ;
77+ char char1 ;
78+ void * null1 ;
79+ void * * array1 ;
80+ struct json1 * next ;
81+ };
82+ int strindex = 0 ;
83+ jumpNULL (json , & strindex );
84+ if (json [strindex ] != '{' ) {
85+ printf ("json parse failed" );
86+ } else {
87+ strindex ++ ;
88+ jumpNULL (json , & strindex );
89+ if (json [strindex ] != '"' ) {
90+ { jumpNULL (json , & strindex ); }
91+ }
92+ if (json [strindex ] != '"' ) {
93+ printf ("json parse failed" );
94+ } else {
95+ }
96+ }
97+ }
0 commit comments