View Code of Problem 110

#include<stdio.h>
int main()
{
  int i,j,a,b,n;
  int a[n][2];
  for(i=0;i<n;i++)
    for(j=0;j<2;j++)
    {
      scanf("%d %d",&a,&b);
  printf("%d\n",a+b);
    }
  return 0;
}  
/*
Main.c: In function 'main':
Main.c:5:7: error: conflicting types for 'a'
   int a[n][2];
       ^
Main.c:4:11: note: previous declaration of 'a' was here
   int i,j,a,b,n;
           ^
Main.c:9:7: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int (*)[(sizetype)(n)][2]' [-Wformat=]
       scanf("%d %d",&a,&b);
       ^
Main.c:10:3: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int (*)[2]' [-Wformat=]
   printf("%d\n",a+b);
   ^
*/

Double click to view unformatted code.


Back to problem 110