#include // modifica un tablou punand toate elementele negative in fata void split(int t[], unsigned len) { int left = 0, right = len - 1; while (left < right) { while (left < len && t[left] < 0) ++left; while (right >= 0 && t[right] >= 0) --right; if (left < right) { int aux = t[left]; t[left] = t[right]; t[right] = aux; ++left; --right; } } } void printtab(int t[], unsigned len) { for (unsigned i = 0; i < len; ++i) printf("%d ", t[i]); putchar('\n'); } int main(void) { int tab[] = { 5, -9, 5, 6, -8, -4, 3, 2, 0, -7, 1 }; split(tab, 11); printtab(tab, 11); return 0; }