Skip to content

Instantly share code, notes, and snippets.

@davixcky
Created June 23, 2020 21:41
Show Gist options
  • Save davixcky/306443722d087dbd23c9943a5151ac4f to your computer and use it in GitHub Desktop.
Save davixcky/306443722d087dbd23c9943a5151ac4f to your computer and use it in GitHub Desktop.
#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