Sorting the array will NEVER return 1,2. It has 10 members. What values do the other members hold? Use your debugger to find out.
The array only has only two members initiallised and you sort the whole array. The other values of the array are unknown. They need to be set to something.
int arr[10] = {0,0,0,0,0,0,0,0,0,0};
arr[0] = 1;
arr[1] = 2;
You may choose to sort only the first 2 (or initialised members) - you must then only display that subsection of the array not the whole 10 members. That will then give 1,2.
[Edit]
1. Yes you must set all values to known values - you can use a for loop or memset().
2. You can as I said sort a subset of your array - you must then only display those sorted values not the whole array.