🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Structure et tableau en C ?

#60
From: Emmanuel Delahaye
Date: Sat, 05 Feb 2005 10:35
33 lines
2019 bytes
Thierry59 wrote on 03/02/05 :
> Si on declare un tableau de char....   char table[512]
>
> ensuite une structure (avec divers type: char , pointeur) qui prend en
> memoire 512 octets.
>
> le tableau et la structure prenne normalement la m�me place....alors ma
> question est:
>
> peut'on initialiser la structure directement avec les valeurs de la table,
> en 1 seul ligne de code.... dire par ex que le pointeur de la structure est
> egal au pointeur de la table ( calquer le tableau sur la structure et vice
> versa....).
>
> Si oui, comment ca s'ecrit....

struct T *p = (struct T *) table;

On peut mais c'est pas portable. Ca convient pour un usage strictement 
interne, mais pas pour une interface externe (flux, m�moire 
partag�e...)

copie f.c.l.c.
FU-2 f.c.l.c.

-- 
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"Clearly your code does not meet the original spec."
"You are sentenced to 30 lashes with a wet noodle."
-- Jerry Coffin in a.l.c.c++
Technical Details
Message-ID: <mn.2ab77d52fdfd0d34.15512@YOURBRAnoos.fr>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!infeed-2.proxad.net!news15-e.free.fr!not-for-mail
References: <ctu7go$9cu$1@news.tiscali.fr>

Show Full Headers
Complete Article Headers
X-Google-Thread: f9822,807078fb0437ad92
X-Google-Thread: 102e15,9f3075a9014ccc0b
X-Google-Attributes: gidf9822,gid102e15,public
X-Google-Language: FRENCH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!infeed-2.proxad.net!news15-e.free.fr!not-for-mail
Subject: Re: Structure et tableau en C ?
From: Emmanuel Delahaye <emdel@YOURBRAnoos.fr>
References: <ctu7go$9cu$1@news.tiscali.fr>
Newsgroups: fr.comp.lang.c,fr.comp.developpement
Message-ID: <mn.2ab77d52fdfd0d34.15512@YOURBRAnoos.fr>
Followup-To: fr.comp.lang.c
X-Newsreader: MesNews/1.02.00.01
Date: Sat, 05 Feb 2005 11:35:03 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 34
Organization: Guest of ProXad - France
NNTP-Posting-Date: 05 Feb 2005 11:35:03 MET
NNTP-Posting-Host: 81.65.109.78
X-Trace: 1107599703 news15-e.free.fr 26606 81.65.109.78:11996
X-Complaints-To: abuse@proxad.net