[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
 

Array af pointere til strukturer



Hej,

I ANSI C, hvordan skriver jeg da en funktion, der returnerer et
NULL-termineret array af pointere til en typedef'et struct? Jeg har
fundet frem til hvordan prototypen af funktionen kommer til at se ud,
men mine færdigheder ud i C pointere er vist en smule rusten. :(

Mit spørgsmål går på hvordan jeg allokerer/tilgår n antal objekter og
returnerer et array af pointere til dem, se eksempel nedenfor... det er
altså syntaksen, jeg ikke lige kan greje...

Eksempel:
==============================
typedef struct {
  ...
} FooBar;

FooBar **
get_foobars (void)
{
  FooBar **foo;
     /* hvordan allokerer/tilgår jeg n antal objekter af typen FooBar */
     /* hvor n >= 0 ?                                                 */
  return foo;
}
==============================

Mvh
./Brix
-- 
Henrik Brix Andersen <sslug@sslug>



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

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