[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
 

Re: [CPROG] [C] linkede lister og warnings.



On Tue, 25 Nov 2003 17:18:51 +0100
Kim Schulz <sslug@sslug> wrote:

> 
> typedef struct {
> 	int ordernr;
> 	int hylde;
> 	int varenr;
> 	int antal;
> 	struct Orderliste *next;
> 
> } Orderliste;
> 
> og så har jeg mit opstartelement:
> OrdreListe *Ordre;

Må man det? 

Typedef er blandt visse programmører overpopulært. Det er ikke
beregnet til sådan nogen ting, med mindre, du ved, hvad du gør,
jeg selv er ikke helt sikker.

Men !!!

Jeg mener, at du skal angive et navn, en såkaldt tag, efter ordet
struct, hvis du skal referere til structen med en linked-list pointer.

Altså således (min foretrukne skrivemåde):

struct Orderlist_tag {
 int ordernr;
 int hylde;
 int varenr;
 int antal;
 struct Orderlist_tag *next;
};

struct Orderlist_tag Orderlist_variable_instantiation;

ELLER

typedef struct Orderlist_tag Orderlist_type;


Kan du følge mig?


P.S.

typedef kan med fordel bruges til signal() prototypen, ellers pas på.


-- 
sslug@sslug -- http://d-axel.dk/


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:10 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] *