C/C++ code to do customized string comparing
First pick a language.

Either use C or use C++. Do NOT use a mixture of the two (its sloppy and can introduce bugs). So first off you should have picked a language. You seem to have picked both:

 #include &lt;cmath&gt;                         // C++
 printf("%d\n", my_compare("ab", "1"));   // Why use printf in C++
                                          // It is obtuse dangerous (not type safe).


The two languages have a basic similar syntax but they are different languages treat them as such.

Know what is available from the standard libraries:

bool is_num(char x) {return (x&gt;='0' &amp;&amp; x&lt;='9');}


This exists in the standard library as std::isdigit()

If this is C++ why are you passing C-Strings around.

int get_num(const char* s, int len)


Much better to write:

int get_num(std::string const&amp; s)


Also there is no point in writing this function (especially since it is error prone to do so.


In c++ use operator&gt;&gt; to stream to an int.
In C use sscanf(s, "%d%n", &amp;value, $length).


Also your variable names are bad. Pick names that make it easy to read the code and understand what you are doing.

    int j = 0;
    int ret = 0;
    while (len &gt; 0)
    {
        // Why add the extra complexity of `j++` here.
        // You have made the expression hard enough to read as it is.
        // You don;t get points for being clever in an interview its readability
        // we want to see.
        ret += (s[j++] - '0') * pow(10, len-1);
        len --;
    }
    return ret;
}


Yes in C it is traditional to put all the variables at the top of the function (so fine for C). But in C++ this is considered bad practice and sloppy. Declare variables as close to the point you want to use them (preferably just before you use them). That way you can see the type at the point you are using them.

        int value1 = 0;
        int value2 = 0;
        bool is_t1_num = false;
        bool is_t2_num = false;
        int len_t1 = 0;
        int len_t2 = 0;
        const char*  t1;
        const char*  t2;


You are repeating the same processes twice.
First you scan over the string finding the length of the number.
Second you scan over the string calculating the value of the number.
There is no need to do that. Use one pass.

            while(is_num(*t1)&amp;&amp;(*t1))
            {
                len_t1 ++;
                t1++;
            }
            value1 = get_num(s1, len_t1);


Also you have the same boilerplate code for both t1 and t2. If you have code that does the same thing factor it out into a function.