Your array is defined with a size 0.
Later on, you read size, but at that point arr is already initialised.
The error happens when you actually try to write this array:
Every such call is writing to memory that does not belong to you (remember, your array's size is 0).
You can declare and define your array after you've read size.
printf("input size of array: ");