[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

[C] Array, pointer og struct



Hej med jer

Jeg kager lige i øjeblikket rundt med pointers, arrays og structs.

Jeg har en struct der er defineret som:

struct block {
    int number;
    struct block *next;
};

Som man nok kan se, er det menningen at den skal lave en linked liste med sig selv.

Samtidigt bliver alle blocks gemt i en array

struct block blocks[25];

Endvidere har jeg også en funktion som skal bruges til at manipulere disse structs med.

void moveOnto(int *from, int *to) {
    if (blocks[*from].next != NULL) {
        returnBlock(blocks[*from].next);
    }

}

void returnBlock(struct block *block) {
    if (*block.next != NULL) {

    }
}


Når jeg kompilerer min kode, så får jeg fejlen:



000101.c:  In function `returnBlock':
000101.c:110: error: request for member `next' in something not a structure or union



Jeg vil umiddelbart antage at fejlen ligger i: returnBlock(blocks[*from].next);

Jeg synes bare ikke rigtig at kunne finde nogle ressourcer på nettet, om hvordan jeg får pointers, arrays og structs til at spille pænt sammen.

Med venlig hilsen

Martin Hjort Eriksen



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *