| 16 | } |
| 17 | |
| 18 | int IsSorted(struct Array* arr) |
| 19 | { |
| 20 | for (int i = 0; i < arr->length - 1; i++) |
| 21 | { |
| 22 | if (arr->A[i] > arr->A[i + 1]) // if 1st element is greater then 2nd element then it will k/as not sorted so return 0 |
| 23 | return 0; |
| 24 | } |
| 25 | |
| 26 | return 1; // if everything is ok and the element came successfully out of loop means it is sorted return 1 for thet |
| 27 | } |
| 28 | int main() |
| 29 | { |
| 30 | struct Array arr; |