palindrome code not working

#include<stdio.h>
#include<ctype.h>

int num[100001];
void carry(int [], int);
int main()
{
    int test, counter, bit, flag;
    int start, end;
    scanf("%d",&test);
    for(counter = 0; counter <= test; counter++)
    {
	flag= 0, num[flag] = 0;
	while((bit = getchar()) != '\n')
	    num[++flag] = (int)(bit - '0');
	if(counter != 0)
	{
	    if(flag == 1)
		printf("%d\n",11);
	    else
	    {
		end = flag;
		carry(num , end);
		start = (num[0] == 0)?1:0;
		while(start <= end)
		{
		    if(num[start] < num[end])
			carry(num,end-1);
		    if(num[start] == num[end])
			;
		    else
		    {
			num[end] = num[start];
		    }
		    start++;
		    end--;
		}
		for(bit = 0; bit <= flag; bit++)
		{
		    if(bit == 0 && num[0] == 0)
			;
		    else
			printf("%d",num[bit]);
		}
		printf("\n");
	    }
	}
    }
    return 0;
}

void carry(int num[], int end)
{
    int carry = 1;
    while(carry != 0)
    {
	num[end] = num[end] + 1;
	if(num[end] == 10)
	{ num[end] = 0;
	    end--;
	    carry= 1;
	}
	else
	    carry = 0;
    }
}

Can anyone tell me why i am getting Runtime Error(SIGSEGV) during submission.

your code gives tle on ideone even on sample case

bit is an integer and you are assigning an character to it ,

we have to use for loop t times whereas you are running t+1 times , also your approach is totally wrong

the code is not complete & am using it just to store the number in array & doing calculation.my problem is that the program stops when i input the number ,probably in the while loop where i do pointer calculation.
can u tell me if there is any mistake in my while loop where i am doing address & pointer calculation.
PS that t+1 time is becz for first input getchar reads input from scanf after i hit enter key.

http://www.codechef.com/viewsolution/5642890
here is the full solution
can anyone tell me why i am getting Runtime Error(SIGSEGV).

here i have written same solution with char num[1000001] instead of int num[1000001] & is getting wrong answers :-
http://www.codechef.com/viewsolution/5645136
plz look at this one.