Thread: Help with linked list

  1. #1
    Registered User
    Join Date
    Jan 2017
    Posts
    2

    Help with linked list

    Code:
    I got the errors:  
    mylib.c:8:16: error: expected declaration specifiers or ‘...’ before ‘percorso’
     void initLista(percorso *prima_terra){
                          ^
    mylib.c:12:26: error: expected declaration specifiers or ‘...’ before ‘percorso’
     void inserisciTestaLista(percorso *prima_terra, int elemento){
                                           ^
    with this code:
    
    
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    #include "mylib.h"
    
    
    static struct Terra* percorso;
    
    
    void initLista(percorso *prima_terra){
    *prima_terra=NULL;
    }
    
    
    void inserisciTestaLista(percorso *prima_terra, int elemento){
    percorso tempo;
    tempo=malloc(sizeof(percorso));
    tempo->tipo_terra=elemento;
    tempo->tipo_mostro=elemento;
    tempo->tesoro=elemento;
    tempo->terra_successiva=*prima_terra;
    *prima_terra=tempo;
    }
    
    
    void crea_percorso(){
    return;
    }
    
    
    void muovi_Oberon(){
    return;
    }
    
    
    void termina_gioco(){
    return;
    }
    How should I fix it?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 13
    Last Post: 09-22-2013, 10:34 PM
  2. Declaring linked list inside linked list
    By blueboyz in forum C Programming
    Replies: 33
    Last Post: 04-20-2012, 10:13 AM
  3. single linked list to double linked list (help)
    By Countfog in forum C Programming
    Replies: 8
    Last Post: 04-29-2008, 08:04 PM
  4. singly linked list to doubly linked list
    By t48j in forum C Programming
    Replies: 3
    Last Post: 03-23-2005, 06:37 PM
  5. Replies: 6
    Last Post: 03-02-2005, 02:45 AM

Tags for this Thread