If you are expecting values out of the data array you probably want at the "nearest-rank method" of wikipedia (
https://en.wikipedia.org/wiki/Percentile).
But there are many other definitions...
The one which still is easy to understand is as follows: Draw the 20 indices on a sheet of paper, maybe in 1cm steps, and label them by the index number on one side of the axis and by the data point value on the other side - see the attached screenshot taken from TAChart. The quartiles divide the line between the first (0) and last index (19) in quarters by length. The 1st quartile (25%) is at "index" 19/4 = 4.75, the 2nd quartile, or median, (50%) at "index" 19/2 = 9.5, and the 3rd quartile at "index" 19*3/4 = 14.25. The quartiles are the data values at these indices. But indices are integers. How to get a data value at a fractional index? By interpolation...
Let's begin with the median (50%) because it is more easy to understand: The data value before the division point at index 9.5 is the one at index 9 with value 22, the one after the division point is at index 10 with value 24. The division is right in the center (9.5), therefore we take the simple average between the two data values: (22+24)*0.5 = 23 (or in other words, both values are equally weighted by the factor 0.5: 22*0.5 + 24*0.5) -- this is the median.
The 25%-point is at "index" 4.75. The plot shows that it would be unfair if both neighbors were weighted equally in the average. Since 4.75 is closer to 5 (the first index after the division) the overall value should be closer to x[5] than to x[4]. Precisely: we weight x[5] by the factor 0.75 (the fractional part of 4.75) and x[4] by 1-0.75 = 0.25: x[4]*0.25 + x[5]*0.75 = 17*0.25 + 19*0.75 = 18.5 -- this is the 1st quartile at 25%.
The calculation is the same for the 75% percentile. It is at "index" 14.25, i.e we need the data values as index 14 and 15 and we weight them by the factors 0.75 and 0.25, respectively: 38*0.75 + 40*0.25 = 38.5
You can estimate the same values from the plot in the screenshot by visual inspection.
In my opinion, however, these differences are rather irrelevant. Press and Flannery wrote somewhere in their famous book "Numerical Recipes" about the ominous formula for the standard deviation (where nobody understands why it is divided by N-1 rather than by N) that when it matters whether 1 is subtracted from the number of data values you have a problem anyway because you need a large number of samples in order to do good statistics, and it is really no big difference whether you have 1000 values or 999.