数据结构入门题,计算a+b的值

输入n组数据;
下面n组,每组两个数a,b;(0<=a,b<=100)
输出a+b的值。

代码是在visual studio 2019上写的也能运行起来,但是没过OJ,不知道哪个地方出了问题,谢谢!

#include <stdio.h>
#include <stdlib.h>

 struct arrye {
    int a;
    int b;
    struct arrye* next;
};
 typedef struct arrye   arry;
 typedef arry* link;

 int main(void)
 {
     link ab = NULL;
     link c = NULL;
     int i=0;
     int n=0;
     ab = (link)malloc(sizeof(arry));
     if (ab == NULL)
         return 0;
     ab->next = NULL;
           c = ab;
     scanf_s("%d", &n);//这个已经改成了scanf
    
     while (i < n) 
     {
         c->next = (link)malloc(sizeof(arry));
         c = c->next;
         c->next = NULL;
         scanf_s("%d %d", &c->a, &c->b);
         if ((c->a) < 0 || (c->b) > 100)
             return 0;
         i++;

     }
     c = ab->next;
     i = 1;
     while (c != NULL)
     {
         printf("case #%d:\n", i);
         printf("%d\n", c->a + c->b);
         c = c->next;
         i++;
      }
    
     while (ab != NULL)
     {
         c = ab->next;
         free(ab);
         ab = c;

     }
         return 0;
 }

我怀疑是这里问题if ((c->a) < 0 || (c->b) > 100)输入错误应该是重新输入,而不是返回,你试试。