Hardware Reference
In-Depth Information
sum_of_cars() function
This function computes the number of vacant slots available in the parking lot accord-
ing to the number of cars parked ( car[1] to car[16] variables). At first, this function uses
read_mux function to scan and store the state of each parking slot in the car array. Then it
changes the initial content of capacity_sam variable to zero and uses it to store number of
available car in parking lot. The number of parked cars is calculated by the following loop
for(i=1;i<17;i++)
capacity_sam+=car[i];
Then capacity_sam variable is deducted from 16 get the available capacity instead of the
number of parked car in the parking lot.
capacity_sam=16-capacity_sam;
Search WWH ::




Custom Search