Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 2, 2019 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/ddaea5d032ce780be160bc710b56fff3 to your computer and use it in GitHub Desktop.
Save parzibyte/ddaea5d032ce780be160bc710b56fff3 to your computer and use it in GitHub Desktop.
// Operación push
void agregar(int numero) {
printf("Agregando %d\n", numero);
// El que se agregará; reservamos memoria
struct nodo *nuevoNodo = malloc(sizeof(struct nodo));
// Le ponemos el dato
nuevoNodo->numero = numero;
// Y ahora el nuevo nodo es el superior, y su siguiente
// es el que antes era superior
nuevoNodo->siguiente = superior;
superior = nuevoNodo;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment