This code checks if string has correct format for passing to struct. Correct format needs to be [123456789'\t'First Name'\t'Last Name'\t'City]. I didn't know how to enter tabs, so I used '\t'. I use them to separate different word blocks so e.g. first and middle name can be read to a first name in struct.I wrote alternative version as well (in comments). Which one is more preferable?How is the correct form to write nested ternary operatorint checkString(char *string, int len){    char *ch;    int flag = FALSE;    int i = 0;    ch = string;    i = 0;    /*    while (ch[i] && ch[i] != '\t') {        if (isdigit(ch[i])) {            if (++i == len) {                flag = ch[i] == '\t' ? TRUE : FALSE;            }        } else { ch++; }    }    */    /* ID code needs to be 11 digits */    for (i = 0; ch[i] && ch[i] != '\t';        isdigit(ch[i]) ?         flag = ++i == len ?             // while true        ch[i] == '\t' ? TRUE : FALSE    // while true        : FALSE         : *ch++);    /* Three tabs is correct */    if (flag) {        for (i = 0; ch[i];        ch[i] == '\t' ?        flag = ++i == 3 ? TRUE : FALSE        : *ch++);    }    return flag;}
Validating a tab-delimited string
c;strings;validation;comparative review