Created
August 7, 2019 22:55
-
-
Save parzibyte/7b39f92ec13a582ea3b4f71b7401efc9 to your computer and use it in GitHub Desktop.
Intercambiar variable sin temporal - https://parzibyte.me/blog/2018/09/27/intercambiar-dos-enteros-sin-usar-una-variable-temporal/
This file contains 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> | |
int main(int argc, char const *argv[]) | |
{ | |
int primera = 10, segunda = 20; | |
printf("Antes de intercambiar. Primera: %d, segunda: %d\n", primera, segunda); | |
primera = primera + segunda; | |
segunda = primera - segunda; | |
primera = primera - segunda; | |
printf("Despues de intercambiar. Primera: %d, segunda: %d\n", primera, segunda); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment