C language to determine whether a number is a palindrome

C language to determine whether a number is a palindrome

int is_palindrome_number(int v)
{
    int rv = 0, ov = v, t;
 
    while (v) {
        t = v % 10;
        rv = rv * 10 + t;
        v /= 10;
    }
 
    return (ov == rv) ? 1 : 0;
}

Comments

Popular posts from this blog

Python Receiving and parse JSON Data via UDP protocol

ubus lua client method and event registration code demo/example