C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Array

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German)
View previous topic :: View next topic  
Author Message
Frank Mockenhaupt
Guest





PostPosted: Thu Jan 26, 2006 1:44 pm    Post subject: Array Reply with quote



Hallo;

Wie kann ich alle Elemente eines Arrays direkt bei der Deklaration mit
einem (Start-)Wert definieren?

Vielen Dank
mfg

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
Falk Tannhäuser
Guest





PostPosted: Thu Jan 26, 2006 2:02 pm    Post subject: Re: Array Reply with quote



Frank Mockenhaupt wrote:
Quote:
Wie kann ich alle Elemente eines Arrays direkt bei der Deklaration mit
einem (Start-)Wert definieren?

Meinst sicher "initialisieren".

int const arr[] = { 32, 16, 8 };

MfG
Falk

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Frank Mockenhaupt
Guest





PostPosted: Thu Jan 26, 2006 3:37 pm    Post subject: Re: Array Reply with quote



Hallo;
Ich meine, wie ich alle Elemente eines Arrays beim Start mit einem Wert
initialisieren kann ohne explizit jeden Wert einzeln angeben zu müsse.
z.B. int array[] = {0,0,0,0}

MfG

Falk Tannhäuser schrieb:
Quote:
Frank Mockenhaupt wrote:
Wie kann ich alle Elemente eines Arrays direkt bei der Deklaration mit
einem (Start-)Wert definieren?

Meinst sicher "initialisieren".

int const arr[] = { 32, 16, 8 };

MfG
Falk


--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Dietmar Kuehl
Guest





PostPosted: Fri Jan 27, 2006 1:16 am    Post subject: Re: Array Reply with quote

Frank Mockenhaupt wrote:
Quote:
Ich meine, wie ich alle Elemente eines Arrays beim Start mit einem Wert
initialisieren kann ohne explizit jeden Wert einzeln angeben zu müsse.
z.B. int array[] = {0,0,0,0}

Für Arrays, die mit Null initialisiert werden sollen ist das einfach:

int array[10] = {};

Für den Fall, dass man einen anderen Wert haben möchte, muß man
allerdings die Notation etwas ändern:

std::vector<int> array(10, 17);
--
<mailto:dietmar_kuehl (AT) yahoo (DOT) com> <http://www.dietmar-kuehl.de/>
<http://www.eai-systems.com> - Efficient Artificial Intelligence

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.