🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fr.comp.lang.c
Article #15358

Re: Tableau: différence entre pile et tas

#15358
From: dab
Date: Fri, 30 Sep 2005 12:17
27 lines
2449 bytes
J'ai essayé en traitant mes 2 tables comme 2 vecteurs de pointeurs.
J'ai changé le prototype de ma fonction: computeNeighbors comme ceci:
void computeNeighbors(t_grid_point* gridPointTable[], int
gridPointTableSize,
                        t_sorted_grid_point* distTable[]);
J'accède à chaque élement ainsi distTable[x*NB_NEIGHBOR+y].
J'ai modifié le code en fonction et je fais des malloc pour créer
chaque  t_sorted_grid_point au moment ou je l'insère et ça marche.
Mais je ne sais toujours pas d'ou proviens l'erreur.

Quand on utilise cette notation distTable[x][y], le compilo
considère-t-il automatiquement que la mémoire est contigu quelle que
soit la manière dont a été initialisé distTable?

Si on alloue distTable ainsi, comment est-ce qu'on peut allouer aux
éléments du tableau en utilisant quelque chose comme (*distTable[x
])[y ]  ?

distTable = malloc(NB_MAX_GRID_POINT*sizeof(void *));
for(inc=0; inc<NB_MAX_GRID_POINT; inc++) {
        distTable[inc] =
malloc(NB_NEIGHBOR*sizeof(t_sorted_grid_point));
} 

En tout cas merci.

David
Technical Details
Message-ID: <1128082651.908510.81550@o13g2000cwo.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mail
References: <1127923112.347881.79740@z14g2000cwz.googlegroups.com> <1128006219.590857.313500@g47g2000cwa.googlegroups.com> <dhh0u1$nn7$1@s1.news.oleane.net>

Show Full Headers
Complete Article Headers
X-Google-Thread: f9822,9ee84542aed426f5
X-Google-Attributes: gidf9822,public
X-Google-Language: FRENCH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mail
From: dab@acri-st.fr
Newsgroups: fr.comp.lang.c
Subject: Re: Tableau: différence entre pile et tas
Date: 30 Sep 2005 05:17:31 -0700
Organization: http://groups.google.com
Lines: 28
Message-ID: <1128082651.908510.81550@o13g2000cwo.googlegroups.com>
References: <1127923112.347881.79740@z14g2000cwz.googlegroups.com>
   <1128006219.590857.313500@g47g2000cwa.googlegroups.com>
   <dhh0u1$nn7$1@s1.news.oleane.net>
NNTP-Posting-Host: 213.244.27.2
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1128082657 28045 127.0.0.1 (30 Sep 2005 12:17:37 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 30 Sep 2005 12:17:37 +0000 (UTC)
In-Reply-To: <dhh0u1$nn7$1@s1.news.oleane.net>
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; fr-FR; rv:1.7.10) Gecko/20050717 Firefox/1.0.6,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: o13g2000cwo.googlegroups.com; posting-host=213.244.27.2;
   posting-account=nfO__g0AAAB3e6qRD0Nckfeo-0DvYDH1