I would like to create a small parking system with 10 space.
Then the system may assign the 1st entered car to the nearest space.
I would like to implement the car park space using array.
And the distance is save into array.
e.g. A[2]=2 means tat at array A[2] its distance from entrance is 2
so when the car enter the car park, the system will search from the available array and assign the leaser distance's space to the driver.
Anyone have idea to guide me how to implement this ?

You will want to use a two-dimensional array for that -- the first dimension is the distance and the second dimension indicates whether there is a car in that spot or not. So you will want to declare the array something like this:

const int MaxParkingSpaces = 10;
int ParkingSpaces[MaxParkingSpaces][2] = {0};

Next you will need to fill the first dimension with the distances you want.