Article View: fr.comp.lang.c
Article #15361Re: Tableau: différence entre pile et tas
From: Pierre Maurette
Date: Fri, 30 Sep 2005 13:54
Date: Fri, 30 Sep 2005 13:54
45 lines
3160 bytes
3160 bytes
dab@acri-st.fr, le 30/09/2005, a �crit :
> Quel fichier .h est manquant? Chez moi �a compile.
> Sinon, c'est un programme minimal qui reproduit mon erreur
> et je suis sur gdb depuis hier matin.
> Je cherche aussi du cot� de l'adressage mais je n'ai encore rien
> trouv�.
> Je cherche....
Salut again,
Apparemment, vous ne lisez pas mes messages. Je continue quand m�me. Je
pars de votre code (partiel) d'hier � 17h03. Je nettoie quelques
erreurs (revoir peut-�tre le DEBUG), je passe sur quelques warnings
*dont un signale un probl�me concordance de type*, je compile et j'ai
une vilation d'acc�s (votre SEG FAULT) l� o� vous le dites.
Je fais la petite modif que je vous ai sugg�r� trois fois, et �a roule.
Comme je vous le disais, cette modif, qui consiste � utiliser le bon
type, vous aurait permis de ne rien retoucher au code test� avec un
tableau "dans la pile". D�but du code, un peu n'importe comment (y' des
trucs qui doivent �tre dans le .h):
typedef t_sorted_grid_point TdistTable[NB_NEIGHBOR][NB_NEIGHBOR];
int main(int argc, char* argv[]) {
t_grid_point** gridPointTable = NULL;
/* t_sorted_grid_point** distTable = NULL; */
TdistTable* pdistTable =
malloc(NB_MAX_GRID_POINT*NB_NEIGHBOR*sizeof(t_sorted_grid_point));
#define distTable (*pdistTable)
int nbGridPoint = 0, inc, inc2;
/* init data struct */
if (_DEBUG != 0)
printf("Memory allocation\n");
gridPointTable = malloc(NB_MAX_GRID_POINT*sizeof(t_grid_point *));
/* distTable =
malloc(NB_MAX_GRID_POINT*NB_NEIGHBOR*sizeof(t_sorted_grid_point)); */
--
Pierre Maurette
Technical Details
Message-ID:
<mn.f3ba7d592302afb8.31483@laposte.net>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!infeed-2.proxad.net!news18-e.free.fr!not-for-mailReferences:
<1127923112.347881.79740@z14g2000cwz.googlegroups.com> <433c3502$0$17236$8fcfb975@news.wanadoo.fr> <1128062877.527491.168280@g49g2000cwa.googlegroups.com> <433d1e98$0$5409$8fcfb975@news.wanadoo.fr> <1128080997.753599.258340@g49g2000cwa.googlegroups.com>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!news1.google.com!proxad.net!infeed-2.proxad.net!news18-e.free.fr!not-for-mail
Subject: Re: Tableau: différence entre pile et tas
From: "Pierre Maurette" <maurettepierre@wanadoo.fr>
References: <1127923112.347881.79740@z14g2000cwz.googlegroups.com> <433c3502$0$17236$8fcfb975@news.wanadoo.fr> <1128062877.527491.168280@g49g2000cwa.googlegroups.com> <433d1e98$0$5409$8fcfb975@news.wanadoo.fr> <1128080997.753599.258340@g49g2000cwa.googlegroups.com>
Newsgroups: fr.comp.lang.c
Message-ID: <mn.f3ba7d592302afb8.31483@laposte.net>
X-Newsreader: MesNews/1.04.00.00
Date: Fri, 30 Sep 2005 15:54:45 +0200
MIME-Version: 1.0
X-Face: cmi$3R1_J{[}5K|8d'LDiJ$SsZ*gn,j*PhJ#KVGt+45,E_N9O}GrhhQ>fb&q<&lz=g%PEv' u"m)N|KrBMux?2:E?N7Uw3L#H>L#GwM}<qH-?#_Y$B9]$q1"~iUGtN#HVy?}7.`m&iKF>gY:.`W.qu z`1'W'h-AXPmB]#7~<+@H.<0M`-jBkCWbmkcT_*LBVD3|p1a?h1H;cHq{$-vbeP@Hdcqp5z~lwU7ZK `~
Reply-To: maurettepierre@wanadoo.fr
Content-Type: text/plain; charset="iso-8859-15"; format=flowed
Content-Transfer-Encoding: 8bit
X-Antivirus: avast! (VPS 0539-2, 29/09/2005), Outbound message
X-Antivirus-Status: Clean
Lines: 47
Organization: Guest of ProXad - France
NNTP-Posting-Date: 30 Sep 2005 15:53:05 MEST
NNTP-Posting-Host: 84.7.238.229
X-Trace: 1128088385 news18-e.free.fr 903 84.7.238.229:4121
X-Complaints-To: abuse@proxad.net