>g++ -Wall main.cpp -o main
main.cpp: In function 'void printSortedArray(int*, int)':
main.cpp:18:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
main.cpp:19:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
Second thing: You have a semi-colon after your for loop line in printedSortedArray, making your loop not actually be a loop.
Third thing: You are not actually calling your swap function. You're calling std::swap(int&, int&), which is the standard library's swap function, which happened to be internally accessible within <iostream>. This only works by coincidence, and is one reason why "using namespace std;" can be a bad idea if you don't know what you're doing.
I would rename your swap function to something else or put it in its own namespace.
Or just get rid of your swap function and #include <algorithm> to properly access std::swap.