This will do what you expect without any concatenation:

```
int compare(char *a, char *b)
{
char *p1, *p2;
int i, len = strlen(a) + strlen(b);
p1 = a;
p2 = b;
for (i=0;i<len;i++) {
if (*p1 > *p2) {
return 1;
} else if (*p1 < *p2) {
return -1;
}
p1++;
p2++;
if (!*p1) {
p1 = b;
}
if (!*p2) {
p2 = a;
}
}
return 0;
}
```

The pointers `p1`

and `p2`

start at the beginning of `a`

and `b`

respectively and compare character by character for each one, then each pointer is incremented if there’s no difference. When either pointer encounters a null byte, it is reassigned to the start of the other variable to continue from there.

We start by getting the combined length of the two strings and run through the loop that many times.

Working on the decimal representation of the two numbers as strings is actually simpler than dealing with them as integers, as the latter would involve determining the number of decimal digits and multiplying accordingly. This method also isn’t constrained by the bounds of whatever integer type you may be using.

If you need a code without any extra allocation, you can try :

```
#include <string.h>
int compare(const char* a, const char* b)
{
int a_len = strlen(a), b_len = strlen(b);
int min_len = (a_len < b_len) ? a_len : b_len;
int result = strncmp(a, b, min_len);
if (result != 0)
return result;
if (a_len == b_len)
return 0;
if (a_len < b_len)
result = strncmp(b, b+a_len, b_len-a_len);
else
result = strncmp(a+b_len, a, a_len-b_len);
if (result != 0)
return result;
if (a_len < b_len)
result = strncmp(b+(b_len-a_len), a, a_len);
else
result = strncmp(b, a+(a_len-b_len), b_len);
return result;
}
```

It does at most 3 string comparisons. The return value follows the definition of strncmp.