Code gives SIGSEGV error even though its running fine on ideone and devc++

Here’s the code…
'#include<stdio.h>
'#include<stdlib.h>
int main()
{
int p=0, q=0, i, j=0, k=0, m, n, l=0;
double count=0;
//Defines the number of rows of a 2D array using pointer
char inp = (char)malloc(100 * sizeof(char));
//Defines the number of columns of the 2D array
for(i=0;i<100;i++)
inp[i] = (char*)malloc(15 * sizeof(char));

printf("INPUT:\n");
//To take input as given in problem
for(i=0;i<100;i++)
{
	scanf(" %[^\n]", inp[i]);
	if(inp[i][0]=='0' && inp[i][1]==' ' && inp[i][2]=='0')
		break;

}
inp[i][0] = '\0';


printf("\n\nOUTPUT:\n");
//To find the solution to given problem
for(i=0;i<100;i++)
{
	if(inp[i][j]=='\0')
		break;

	//To find row and column of array
	while(inp[i][j]!='\0')
	{
		if(inp[i][j]==' ')
		{
			k=1;
			j++;
		}
		if(k==0)
			p = p*10 + (inp[i][j]-'0');
		if(k==1)
			q = q*10 + (inp[i][j]-'0');
		j++;
	}

	//Traverse the entire array in all directions for each block
	for(m=0;m<p;m++)
	{
		for(n=0;n<q;n++)
		{
			//Going Up
			k=m;
			while(k>0)
			{
				count++;
				k--;
			}

			//Going Down
			k=m;
			while(k<p-1)
			{
				count++;
				k++;
			}

			//Going Right
			l=n;
			while(l<q-1)
			{
				count++;
				l++;
			}

			//Going Left
			l=n;
			while(l>0)
			{
				count++;
				l--;
			}

			//Going Diagonal Right Up
			k=m;
			l=n;
			while(1)
			{
				if(k>0 && l<q-1)
				{
					count++;
					k--;
					l++;
				}
				else
					break;
			}

			//Going Diagonal Left Up
			k=m;
			l=n;
			while(1)
			{
				if(k>0 && l>0)
				{
					count++;
					k--;
					l--;
				}
				else
					break;
			}

			//Going Diagonal Left Down
			k=m;
			l=n;
			while(1)
			{
				if(k<p-1 && l>0)
				{
					count++;
					k++;
					l--;
				}
				else
					break;
			}

			//Going Diagonal Right Down
			k=m;
			l=n;
			while(k<p-1 && l<q-1)
			{
				if(k<p-1 && l<q-1)
				{
					count++;
					k++;
					l++;
				}
				else
					break;
			}
		}
	}
	j=0;
	k=0;
	l=0;
	p=0;
	q=0;
	printf("%.0lf\n", count);
	count=0;
}
return 0;

}`

Please could someone help me out. Thanks in advance.

I am unable to get through your code due to the numerous variables you have used. So, just check your code for ‘array out of bounds condition’. You might be trying to access an array element outside its range.