getting a error

#include<conio.h>
#include<stdio.h>
main(){
int a[100][2],b[100],c[100],x,y,n,d[2],e[2];
printf(“enter the maximum number”);
scanf("%d",&n);
printf(“enter the coordinate”);
for(x=0;x<n;x++)
{
for(y=0;y<2;y++)
{
scanf("%d",&(a[x][y]));
}

	}
	for(x=0;x<=n;x++)
	{
		b[x]=a[x+1]-a[x];
		c[x]=b[x]*b[x];
		printf("c=%d",c[x]);
	}
	for(y=0;x<=2;y++)
	{
		d[x]=a[y+1]-a[y];
		e[x]=d[x]*d[x];
			printf("e=%d",e[x]);
	}
	
}

please provide the link to the problem. It’s really hard to figure out the error without looking at the problem question

Also, format the code or give an ideone link.

a[x][y] is a 2D array and a[x] is a pointer pointing to the base address of an array and pointer subtraction is not allowed

2 Likes

You need to brush up your concepts of 2-D array. It seems that you are new to this thing, so try practicing the tutorial at hackerrank first. Also, google the usual required syntax and uses.

1 Like