[linux] OT: C-vraagje

Hans Paijmans j.j.paijmans op uvt.nl
Vr Feb 11 11:54:17 CET 2005


Ik heb al zes of zeven jaar niet meer in C geprogrammeerd, en
nu is de start wat moeilijk. Kan iemand me een duwtje geven?

Het onderstaande programma (teruggebracht tot de essentie) doet
het niet; ik schijn iets verkeerd te doen bij de typedef...
De compiler beweert bij hoog en bij laag dat field 'posities'
en 'legaal' ongedefinieerd zijn...



#include <stdio.h>

#define POSSIBLE 3
#define POSITIES 7

typedef char p_string[POSITIES];

typedef struct{
    p_string posities;
    int legaal;
  } node;


node *possible_nodes[POSSIBLE];

main()
{
     int x;
     for (x=0;x<POSSIBLE;x++) possible_nodes[x]=(node*)malloc(sizeof(node));
     strcpy(possible_nodes[0]>posities,"LLLL");
     strcpy(possible_nodes[1]>posities,"LLLR");
     strcpy(possible_nodes[2]>posities,"LLRR");

     possible_nodes[0]>legaal=1;
     possible_nodes[1]>legaal=1;
     possible_nodes[2]>legaal=1;



     printf("hoppa!\n");
     for (x=0;x<POSSIBLE;x++)
         {
         printf("%s \n",possible_nodes[x]>posities);
         }
}


-- 
Dr. J.J. Paijmans
Tilburg University, Faculty of Arts,        Dept. of Linguistics & AI
Tilburg, Netherlands (+31) (0)13-4662693    http://pi0959.kub.nl
Home: Elzenstraat 1, 5581 VS Waalre,        http://paijmans.net




More information about the Linux mailing list