Created
September 5, 2012 21:46
-
-
Save gonzalowtf/3645463 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void intercambio1( int, int); | |
int main (int argc, char *argv[]) | |
{ | |
int var1 = 15, var2 = 27; // Inicio | |
printf("\nValores antes de llamar la funcion:\t\t %-4d %-4d", var1, var2); | |
intercambio1(var1, var2); | |
printf("\nValores despues de llamar la funcion:\t\t %-4d %-4d", var1, var2); | |
printf("\n"); | |
return 0; | |
} | |
void intercambio1( int valor1, int valor2) | |
{ | |
int aux; | |
printf("\nValores en la funcion antes del intercambio:"); | |
printf("\t %-4d %-4d", valor1, valor2); | |
aux = valor1; // (1) | |
valor1 = valor2; // (2) | |
valor2 = aux; // (3) | |
printf("\nValores en la funcion despues del intercambio:"); | |
printf("\t %-4d %-4d", valor1, valor2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment