Swap two values · Trocar dois valores
Swap two values
swap receives pointers to two integers and must exchange their values. Through a pointer, *a reads — or writes — the value it points at. Use a temporary variable so you don't lose one value while copying the other.
Troque dois valores
swap recebe ponteiros para dois inteiros e deve trocar seus valores. Através de um ponteiro, *a lê — ou escreve — o valor ao qual aponta. Use uma variável temporária para não perder um valor ao copiar o outro.
Complete void swap(int *a, int *b) to exchange the two integers that a and · e b point to. Use the pointers — *a is the value at a. · Complete void swap(int *a, int *b) para trocar os dois inteiros apontados por a e b. Use os ponteiros — *a é o valor em a.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.