I am receiving a Segmentation Fault on line 11. There might be something wrong with the way i am compiling it because this is the first time that i have used terminal. At any rate, the segfault is in line 11 and i have never had this problem before. Let me know what you think.

Code:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct integer
{
int *digits;
int size;
};
void print(struct integer *p)
{
int i;
for (i = p->size - 1; i >= 0; i--)
printf("%d", p->digits[i]);
}
struct integer *convert_integer(char *stringInt)
{
int i;
struct integer *p = malloc(sizeof(struct integer));
p->size = strlen(stringInt);
p->digits = malloc(sizeof(int) * p->size);
for (i = 0; i < p->size; i++)
p->digits[i] = stringInt[p->size - 1 - i] - '0';
return p;
}
int isZero(struct integer *p)
{
return (p->size == 1 && p->digits[0] == 0);
}
struct integer *multiply(struct integer *p, struct integer *q)
{
int i, j, carry;
struct integer *m;
// Terminate early in special case of multiplication by zero
if (isZero(p) || isZero(q))
return convert_integer("0");
// Create struct to hold product
m = malloc(sizeof(struct integer));
m->size = p->size + q->size;
m->digits = calloc(m->size, sizeof(int));
// Perform multiplication; don't worry about addition overflows yet
for (i = 0; i < q->size; i++)
for (j = 0; j < p->size; j++)
m->digits[i + j] += q->digits[i] * p->digits[j];
// Compensate for addition overflows
for (i = carry = 0; i < m->size; i++)
{
m->digits[i] += carry;
carry = m->digits[i] / 10;
m->digits[i] = m->digits[i] % 10;
}
// Strip leading zero if it exists
if (m->digits[m->size - 1] == 0)
m->size--;
return m;
}
struct integer *destroy_integer(struct integer *p)
{
free(p->digits);
free(p);
return NULL;
}
int main(void)
{
int N, i;
char buffer[10001];
struct integer *p, *q, *m;
FILE *ifp = fopen("bigint.rft", "r");
fscanf(ifp, "%d", &N);
for (i = 1; i <= N; i++)
{
fscanf(ifp, "%s", buffer);
p = convert_integer(buffer);
fscanf(ifp, "%s", buffer);
q = convert_integer(buffer);
m = multiply(p, q);
// Problem Output
printf("Problem #%d: ", i);
print(p);
printf(" * ");
print(q);
printf(" = ");
print(m);
printf("\n");
// Memory Management
p = destroy_integer(p);
q = destroy_integer(q);
m = destroy_integer(m);
}
fclose(ifp);
return 0;
}