Palindrome numbers - Project Euler Problem 4 Project Euler Problem #4: Largest palindrome product:


  A palindromic number reads the same both ways. The largest palindrome
  made from the product of two 2-digit numbers is 9009 = 91 × 99.
  
  Find the largest palindrome made from the product of two 3-digit
  numbers.


I got the correct answer for the problem, but I want to know if my coding style is good or bad for this solution.
I need to know how I can improve my coding, if it is bad and write this in a more general way.

#include&lt;stdio.h&gt;
#define MAX 999
#define START 100

int main()
{
   int i,j,current,n,prev = 0;
for(i = START;i&lt;=MAX;i++)
{
    for(j=START;j&lt;=MAX;j++)
    {
        current = j * i;
        if(current &gt; prev)  /*check the current value so that if it is less need not go further*/
        {
            n = palindrome(current);
            if (n == 1)
            {
                printf("The palindrome number is : %d\n",current);
                prev = current;  // previous value is updated if this the best possible value.
            }
        }
    }
}
}

int palindrome(int num)
{
int a[6],temp;
temp = num;
/*We need a array to store each element*/
a[5] = temp % 10;       
a[4] = (temp/10) %10;
a[3] = (temp/100) %10;
a[2] = (temp/1000) %10;
a[1] = (temp/10000) %10;
if(temp/100000 == 0)
{
    a[0] = 0;
    if(a[1] == a[5] &amp;&amp; a[2] == a[4])
        return 1;
}
else
{
    a[0] = (temp/100000) %10;
    if(a[0] == a[5] &amp;&amp; a[1] == a[4] &amp;&amp; a[2] == a[3])
        return 1;
    else
        return 0;
}
}
First of all, you are only interested in the biggest number, so why do you start from the bottom??
Correcting that allows you to dispense with an explicit lower boundary, a dynamic boundary can be computed depending on current-best result.
Why don't you read the upper boundary from the command-line?
Proper indentation is a very valuable help in quickly and accurately reading source-code, as well as ferreting out errors.
In your case, the one level of indentation missing through much of your code might be an artifact of sloppy posting here. Whether or not it is, don't do that.
You are depending on implicit definition of palindrome. Don't do that, reverse their positions.
An int only has a guaranteed range of -32767 to 32767. Use a long (or unsigned long), that has the proper range without depending on implementation-dependent behaviour.
Why do you use an array and all that paraphernalia to check for being a palindrome, simply reversing is easy:

unsigned long reverse(unsigned long in) {
    unsigned long r = 0;
    for(; in; in /= 10)
        r = r * 10 + in % 10;
    return r;
}



Final program (on coliru):

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

static int is_palindrome(const unsigned long in) {
    unsigned long r = 0;
    for(unsigned long x = in; x; x /= 10)
        r = r * 10 + x % 10;
    return r == in;
}

int main(int argc, char* argv[]) {
    unsigned long max = argc &gt; 1 ? strtoul(argv[1], 0, 10) : 0;
    if(!max || max &gt; 9999)
        max = 999;
    unsigned long _a = 0, _b = 0, _m = 0; // best yet
    for(unsigned long a = max, a_min = 1; a &gt;= a_min; --a)
        for(unsigned long b = max, b_min = _m / a + 1; b &gt;= b_min; --b)
            if(is_palindrome(a*b)) {
                _a = a, _b = b, _m = a*b, a_min = _m / max + 1;
                break;
            }
    printf("Biggest palindrome-number which is product of two natural numbers"
        " no bigger than %lu: %lu = %lu * %lu\n", max, _m, _a, _b);
    return 0;
}