🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: bug dans un petit programme

#15065
From: Emmanuel Delahaye
Date: Sun, 16 Oct 2005 18:03
24 lines
1828 bytes
Thierry B a �crit :
> Quand on declare un pointeur vers un char au lieu d'un tableau, on est

d�finit...

http://mapage.noos.fr/emdel/notes.htm#definitions

> forc� de faire nous m�me le malloc donc (qui appremment n'est pas
> n�cessaire quand on declare un tableau), et ensuite de faire un free
> en fin de programme sur le char* ?

C'est une solution. On peut aussi l'initialiser avec l'adresse du 
premier �l�ment d'un tableau valide.

char s[] = "Hello world";
char *p = s;

D'une fa�on g�n�rale, un pointeur n'est qu'une variable comme une autre. 
Avant de l'utiliser, il faut qu'elle ait �t� initialis�e correctement.

http://mapage.noos.fr/emdel/notes.htm#pointeurs

-- 
C is a sharp tool
Technical Details
Message-ID: <43529602$0$21286$626a54ce@news.free.fr>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!infeed-4.proxad.net!nnrp3-1.free.fr!not-for-mail
References: <1129454997.732041.79560@g43g2000cwa.googlegroups.com> <BF77FB36.4824C%new@levenez.com> <1129461802.259474.27710@g43g2000cwa.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: f9822,825aa0bc6fede96b
X-Google-Attributes: gidf9822,public
X-Google-Language: FRENCH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!infeed-4.proxad.net!nnrp3-1.free.fr!not-for-mail
Date: Sun, 16 Oct 2005 20:03:33 +0200
From: Emmanuel Delahaye <emdelYOURBRA@noos.fr>
User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
X-Accept-Language: fr, en
MIME-Version: 1.0
Newsgroups: fr.comp.lang.c
Subject: Re: bug dans un petit programme
References: <1129454997.732041.79560@g43g2000cwa.googlegroups.com>   <BF77FB36.4824C%new@levenez.com> <1129461802.259474.27710@g43g2000cwa.googlegroups.com>
In-Reply-To: <1129461802.259474.27710@g43g2000cwa.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 24
Message-ID: <43529602$0$21286$626a54ce@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 16 Oct 2005 20:03:46 MEST
NNTP-Posting-Host: 81.65.109.208
X-Trace: 1129485826 nnrp3-1.free.fr 21286 81.65.109.208:29874
X-Complaints-To: abuse@proxad.net