Article View: fr.comp.lang.c
Article #15330Re: Tableau: différence entre pile et tas
From: Antoine Leca
Date: Thu, 29 Sep 2005 10:04
Date: Thu, 29 Sep 2005 10:04
38 lines
2619 bytes
2619 bytes
[ C'est une mauvaise id�e d'utiliser son adresse mail sur Usenet. ] En <news:1127977421.754045.184600@g49g2000cwa.googlegroups.com>, David va escriure: > Pourquoi (void *) ? > > Dans la mesure ou je veux allouer un tableau de pointeur, > est-ce que �a change quelque chose d'utiliser (void*) ou > (t_grid_point*) dans mon malloc? Sur ta machine, tr�s probablement non. Mais il existe des machines o� il peut y avoir des diff�rences, par exemple des void* plus gros que les t_grid_point*. > t_grid_point* gridPointTable = malloc > (NB_MAX_GRID_POINT*sizeof*gridPointTable); > L� par contre, je veux bien une explication STP :) gridPointTable est un tableau ou un pointeur vers son premier �l�ment (peu importe) ; donc *gridPointTable est *un* �l�ment du tableau ; donc sizeof*gridPointTable est la taille d'un �l�ment ; tu multiplie cela par le nombre d'�l�ment, et �a roule. (sizeof n'est pas une fonction, c'est un op�rateur, donc il n'a pas besoin d'avoir des parenth�ses autour de l'argument quand c'est un objet ; il n'est pas faux de mettre des parenth�ses, si tu pr�f�res). > Je savais pour la discontinuit�, mais je n'�tais pas s�r. > Est-ce que ce genre de chose peut changer avec la derni�re norme de C? > (C99 je crois) Non, aucune chance. Antoine
Technical Details
Message-ID:
<dhge78$v3v$1@shakotay.alphanet.ch>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!freenix!news.alphanet.ch!alphanet.ch!not-for-mailReferences:
<1127923112.347881.79740@z14g2000cwz.googlegroups.com> <mn.e4827d59f351819c.15512@YOURBRAnoos.fr> <1127977421.754045.184600@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!freenix!news.alphanet.ch!alphanet.ch!not-for-mail From: "Antoine Leca" <root@localhost.invalid> Newsgroups: fr.comp.lang.c Subject: Re: Tableau: différence entre pile et tas Date: Thu, 29 Sep 2005 12:04:23 +0200 Organization: Posted through ALPHANET (http://www.alphanet.ch/) Lines: 39 Sender: antoinel@143.red-217-127-250.staticip.rima-tde.net Message-ID: <dhge78$v3v$1@shakotay.alphanet.ch> References: <1127923112.347881.79740@z14g2000cwz.googlegroups.com> <mn.e4827d59f351819c.15512@YOURBRAnoos.fr> <1127977421.754045.184600@g49g2000cwa.googlegroups.com> NNTP-Posting-Host: 143.red-217-127-250.staticip.rima-tde.net Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Trace: shakotay.alphanet.ch 1127988264 31871 217.127.250.143 (29 Sep 2005 10:04:24 GMT) X-Complaints-To: usenet@alphanet.ch NNTP-Posting-Date: Thu, 29 Sep 2005 10:04:24 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506