#include <stdio.h>
#include <stdlib.h>
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,n) FOR(i,0,n)
int compar(const void *a, const void *b) {
return *(int *)a < *(int *)b ? -1 : 1;
}
int main(void) {
int n;
printf("Enter the size of the array: ");
scanf("%i", &n);
printf("Enter the elements of the array: ");
int arr[n];
F0R(i,n) scanf("%i", &arr[i]);
int k;
printf("Enter the value of k: ");
scanf("%i", &k);
qsort(arr, n, sizeof(int), compar);
printf("The '%i' largest element in the array is: %i\n", k, arr[n-k]);
}