Listas encadeadas

#include <stdio.h> #include <stdlib.h> struct no{ float dado; struct no *prox; } int main() { tipolista lista, novo; lista = (tipolista) malloc(sizeof(struct no)); if (lista == NULL) printf("não foi possível alocar espaço requisitado \n"); else { printf("digite valor do elemento inteiro: "); scanf("%d", &lista->dado); lista->prox=NULL; } novo= (tipolista) malloc(sizeof(struct no)); if (novo== NULL) printf("não foi possível alocar espaço requisitado \n"); else { printf("digite valor do elemento inteiro: "); scanf("%d", &novo->dado); novo->prox =lista; lista = novo; } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.