How to store values from a sensor inside an empty array?
int i=0; 
  int  dist [i] = {
    calculateDistance()      };


I'm not sure what you are thinking here, but you obviously cannot store data into a zero-length array. You also cannot put a function call to populate an array of variable length.

You need to decide how many elements you need in the array, in advance, and allocate an array of that size.



Maybe more like this:

 int  dist [180];

  for (i=0;i&lt;180;i++){    
    dist [i] = calculateDistance ();
    if (dist[i]&gt;max){
      max=dist[i];
      angle=i;
      Serial.print(angle);
      delay(30);
    }

  }




Also, this is wrong in your code:

for (i=0;i=180;i++){  


You need to test for &lt; 180 here. Your for loop will assign 180 to i and then check to see if it is non-zero, which will always be true.