The Problem
Your array is defined with a size 0.
int size=0;
int arr[size];
Later on, you read size, but at that point arr is already initialised.
The error happens when you actually try to write this array:
scanf("%d",&arr[i]);
Every such call is writing to memory that does not belong to you (remember, your array's size is 0).
The Solution
You can declare and define your array after you've read size.
int main()
{
int size=0;
printf("input size of array: ");
scanf("%d",&size);
int arr[size];
// ...
}