Skip to content

Commit f6fac05

Browse files
committed
Add comment to explain the types of member in struct
1 parent 1df0cf5 commit f6fac05

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎c/Json/test/jsonparser.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ int jumpNULL(const char *string, int *index) {
1313
}
1414
return *index;
1515
}
16-
int sliceString(const char *string, int index, int length);
16+
int sliceStringByLength(const char *string, int index, int length);
17+
int sliceStringByAddress(const char *head, const char *end);
1718
int main() {
1819
const char json[] =
1920
"{\"int1\":1,\"str1\":\"2\",\"double1\":3.14,\"bool1\":true,"
@@ -27,6 +28,8 @@ int main() {
2728
_Bool bool1;
2829
char char1;
2930
void *null1;
31+
// void * -> any type of various
32+
// void ** -> array which can storage any type of various
3033
void **array1;
3134
struct json1 *next;
3235
};
@@ -37,11 +40,12 @@ int main() {
3740
} else {
3841
strindex++;
3942
jumpNULL(json, &strindex);
40-
if (json[strindex] != '"') {
43+
if (json[strindex] == ' ') {
4144
{ jumpNULL(json, &strindex); }
4245
}
4346
if (json[strindex] != '"') {
4447
printf("json parse failed");
48+
} else {
4549
}
4650
}
4751
}

0 commit comments

Comments
 (0)