Created
June 23, 2020 21:41
-
-
Save davixcky/306443722d087dbd23c9943a5151ac4f to your computer and use it in GitHub Desktop.
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> | |
void swap(char *a, char *b) { | |
char c; | |
c = *a; | |
*a = *b; | |
*b = c; | |
} | |
int main() | |
{ | |
// Resuelve las preguntas antes de ejecutarlo por primera vez | |
char word1[] = "Holberton\n"; | |
char *word2 = "Holberton\n"; | |
char word3[] = "Holberton\n"; | |
// Que pasara? | |
printf("%p %p %p\n", &word1, word2, &word3); | |
// RESPONDER CUANDO SE EJECUTE | |
// Por que se ven de esa manera las direcciones? | |
// En uno de los siguientes swap abra un error | |
// Cual? A que se debe el error? | |
swap(word1, word1 + 8); | |
swap(word2, word2 + 8); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment