int main() { int x, y; char vector[20]; x = 5; y = 20; printf("x vale: %d. y vale: %d \n", x, y ); printf("\nLlamada a noSwap\n"); noSwap(x, y ); printf("x vale: %d. y vale: %d \n", x, y ); printf("\nLlamada a swap\n"); swap(&x, &y ); /* importante: pasamos las direcciones de x e y */ printf("x vale: %d. y vale: %d \n", x, y ); rellenaCadena(vector); printf("\nLa cadena contiene ahora: %s \n", vector); system("pause"); }
void permuteDFS(int* arr, int start, int end, vector<int>& set, vector<vector<int>>& res) { int tmp; if (start == end) { set.push_back(arr[start]); res.push_back(set); set.pop_back(); printList(res.back()); return; } for (int i = start; i <= end; i++) { if (noSwap(arr, start, i)) continue; swap(arr[start], arr[i]); set.push_back(arr[start]); permuteDFS(arr, start + 1, end, set, res); swap(arr[start], arr[i]); set.pop_back(); } }