<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Lineare Liste]]></title><description><![CDATA[<p>Hallo, kann mir jemand sagen was folgender Codeschnipsel aus folgendem Programm macht ?</p>
<pre><code>using namespace std;

struct Element
{
	string name;		// person name
	int nummer;			// personal number
	Element *next;		// pointer to next element
};

void insertElement(Element *p, const string &amp;name, int nummer)
{
	Element *q = new Element;
	q-&gt;name = name;
	q-&gt;nummer = nummer;
	q-&gt;next = p-&gt;next;
	p-&gt;next = q;
}

void deleteNextElement(Element *p)
{
	if (p-&gt;next != NULL)	// test if successor exists
	{
		Element* q = p-&gt;next;
		p-&gt;next = q-&gt;next;	// update connection between elements
		delete q;			// delete element (deallocate memory)
	}
}

void printList(Element *p)
{
	while (p != NULL)
	{
		cout &lt;&lt; p-&gt;nummer &lt;&lt; &quot;: &quot; &lt;&lt; p-&gt;name &lt;&lt; endl;
		p = p-&gt;next;
	}
}

int main()
{
	// create a new element
	Element *anfang = new Element;
	anfang-&gt;name = &quot;Peter Meier&quot;;
	anfang-&gt;nummer = 230001;
	anfang-&gt;next = NULL;

	// create a second element and add it to the first one
	Element *zweites = new Element;
	zweites-&gt;name = &quot;Gabi Schmidt&quot;;
	zweites-&gt;nummer = 231127;
	zweites-&gt;next = NULL;			// end of the list
	anfang-&gt;next = zweites;			// connect second element with first one

	// add a third element:
	insertElement(anfang-&gt;next, &quot;Ute Mueller&quot;,  230120);

	// print list
	printList(anfang);

	// delete all elements from the list
	while (anfang-&gt;next != NULL)
	{
		deleteNextElement(anfang);
	}
	delete anfang;

	// wait for user input
	cout &lt;&lt; endl &lt;&lt; endl &lt;&lt; endl &lt;&lt; &quot;Bitte eine Taste druecken ...&quot;;
   	_getch();

	// return error code 0 (no error)
	return 0;
}
</code></pre>
<p>Es geht um folgenden:</p>
<pre><code>void printList(Element *p)
{
	while (p != NULL)
	{
		cout &lt;&lt; p-&gt;nummer &lt;&lt; &quot;: &quot; &lt;&lt; p-&gt;name &lt;&lt; endl;
		p = p-&gt;next;
	}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/323483/lineare-liste</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Jul 2026 22:29:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/323483.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Feb 2014 10:10:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Lineare Liste on Sat, 01 Feb 2014 10:10:38 GMT]]></title><description><![CDATA[<p>Hallo, kann mir jemand sagen was folgender Codeschnipsel aus folgendem Programm macht ?</p>
<pre><code>using namespace std;

struct Element
{
	string name;		// person name
	int nummer;			// personal number
	Element *next;		// pointer to next element
};

void insertElement(Element *p, const string &amp;name, int nummer)
{
	Element *q = new Element;
	q-&gt;name = name;
	q-&gt;nummer = nummer;
	q-&gt;next = p-&gt;next;
	p-&gt;next = q;
}

void deleteNextElement(Element *p)
{
	if (p-&gt;next != NULL)	// test if successor exists
	{
		Element* q = p-&gt;next;
		p-&gt;next = q-&gt;next;	// update connection between elements
		delete q;			// delete element (deallocate memory)
	}
}

void printList(Element *p)
{
	while (p != NULL)
	{
		cout &lt;&lt; p-&gt;nummer &lt;&lt; &quot;: &quot; &lt;&lt; p-&gt;name &lt;&lt; endl;
		p = p-&gt;next;
	}
}

int main()
{
	// create a new element
	Element *anfang = new Element;
	anfang-&gt;name = &quot;Peter Meier&quot;;
	anfang-&gt;nummer = 230001;
	anfang-&gt;next = NULL;

	// create a second element and add it to the first one
	Element *zweites = new Element;
	zweites-&gt;name = &quot;Gabi Schmidt&quot;;
	zweites-&gt;nummer = 231127;
	zweites-&gt;next = NULL;			// end of the list
	anfang-&gt;next = zweites;			// connect second element with first one

	// add a third element:
	insertElement(anfang-&gt;next, &quot;Ute Mueller&quot;,  230120);

	// print list
	printList(anfang);

	// delete all elements from the list
	while (anfang-&gt;next != NULL)
	{
		deleteNextElement(anfang);
	}
	delete anfang;

	// wait for user input
	cout &lt;&lt; endl &lt;&lt; endl &lt;&lt; endl &lt;&lt; &quot;Bitte eine Taste druecken ...&quot;;
   	_getch();

	// return error code 0 (no error)
	return 0;
}
</code></pre>
<p>Es geht um folgenden:</p>
<pre><code>void printList(Element *p)
{
	while (p != NULL)
	{
		cout &lt;&lt; p-&gt;nummer &lt;&lt; &quot;: &quot; &lt;&lt; p-&gt;name &lt;&lt; endl;
		p = p-&gt;next;
	}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2380957</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2380957</guid><dc:creator><![CDATA[ZetaGamma]]></dc:creator><pubDate>Sat, 01 Feb 2014 10:10:38 GMT</pubDate></item><item><title><![CDATA[Reply to Lineare Liste on Sat, 01 Feb 2014 10:12:52 GMT]]></title><description><![CDATA[<p>Gibt die Liste aus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2380958</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2380958</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Sat, 01 Feb 2014 10:12:52 GMT</pubDate></item><item><title><![CDATA[Reply to Lineare Liste on Sat, 01 Feb 2014 11:40:51 GMT]]></title><description><![CDATA[<p>Danke. Ich habe da mal noch eine letzte Frage.</p>
<p>zweites-&gt;nummer = 231127; // Heißt das, zweites zeigt auf nummer, welche 231127 lautet?</p>
<p>q-&gt;next = p-&gt;next; // q zeigt auf next und dieser ist der gleiche auf den p zeig ? ....</p>
<p>Kanst du mir sagen wie ich diese zwei Codeschnipsel interpretieren kann ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2380969</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2380969</guid><dc:creator><![CDATA[ZetaGamma]]></dc:creator><pubDate>Sat, 01 Feb 2014 11:40:51 GMT</pubDate></item><item><title><![CDATA[Reply to Lineare Liste on Sat, 01 Feb 2014 11:43:42 GMT]]></title><description><![CDATA[<blockquote>
<p>zweites-&gt;nummer = 231127; // Heißt das, zweites zeigt auf nummer, welche 231127 lautet?</p>
</blockquote>
<p>Nein, <code>zweites</code> ist ein Zeiger auf eine Klasse, welche einen Member namens <code>nummer</code> hat, welchem der Wert 231127 zugewiesen wird.</p>
<p>Der Pfeil-Operator ist eine Kurzschreibweise für <code>(*zweites).nummer = ..;</code></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2380970</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2380970</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Sat, 01 Feb 2014 11:43:42 GMT</pubDate></item><item><title><![CDATA[Reply to Lineare Liste on Sat, 01 Feb 2014 12:39:09 GMT]]></title><description><![CDATA[<p>Danke, ich hätte da noch eine letzte Frage. Manche Funktionen brauchen ja</p>
<p>Element *p</p>
<p>z.b. mit anfang-&gt;next. Kannst du mir nur noch das leicht erklären was das heißt ? Ist mit anfang-&gt;next gemeint das es ein Zeiger ist mit Member next? Und was heißt genau Member ? Und wozu das Element *p. Was heißt das genau? Das wärs dann.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2380976</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2380976</guid><dc:creator><![CDATA[ZetaGamma]]></dc:creator><pubDate>Sat, 01 Feb 2014 12:39:09 GMT</pubDate></item><item><title><![CDATA[Reply to Lineare Liste on Sat, 01 Feb 2014 12:40:47 GMT]]></title><description><![CDATA[<p>Nein, da habe ich keine Lust mehr. Hol dir ein Grundlagenbuch, wir bringen doch hier kein C++ bei!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2380977</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2380977</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Sat, 01 Feb 2014 12:40:47 GMT</pubDate></item><item><title><![CDATA[Reply to Lineare Liste on Sat, 01 Feb 2014 12:43:33 GMT]]></title><description><![CDATA[<p>fürchterliches pseudo-c++ im eröffnungspost... (womit) lernst du c++?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2380978</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2380978</guid><dc:creator><![CDATA[Fytch]]></dc:creator><pubDate>Sat, 01 Feb 2014 12:43:33 GMT</pubDate></item><item><title><![CDATA[Reply to Lineare Liste on Sat, 01 Feb 2014 13:03:27 GMT]]></title><description><![CDATA[<p>@Arcoth. Kannst du mir etwas empfehlen. Irgendeine Lektüre die C++ verständlich und einfach erklärt ? Bzw. einfacher als manch andere Lektüre? Ich finde leider nichts passendes ..</p>
<p>@asfdlol. Ich habe bisher <a href="http://www.highscore.de" rel="nofollow">http://www.highscore.de</a> genutzt, weil mir jemand es geraten hatte... Ich finde einfach nichts nützliches zu verketten Listen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2380984</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2380984</guid><dc:creator><![CDATA[ZetaGamma]]></dc:creator><pubDate>Sat, 01 Feb 2014 13:03:27 GMT</pubDate></item><item><title><![CDATA[Reply to Lineare Liste on Sat, 01 Feb 2014 13:15:10 GMT]]></title><description><![CDATA[<p>Das mit verketteten Listen kannst du dir wie Zettel/Karteikarten vorstellen, die du in der Wohnung verteilst.<br />
Auf den Karten schreibst du die Informationen und den Ort, wo die nächste Karte ist.</p>
<p>Jetzt brauchst du noch zwei Zettel. Auf dem einen steht, wo die erste Karte liegt.<br />
Auf der anderen ist vermerkt, wo gerade die aktuelle Karte ist, mit der du arbeitest.<br />
(Das sind deine Zeiger)</p>
<p>Ach ja, Member: <a href="http://dict.leo.org/?lp=ende&amp;from=fx3&amp;search=Member" rel="nofollow">http://dict.leo.org/?lp=ende&amp;from=fx3&amp;search=Member</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2380986</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2380986</guid><dc:creator><![CDATA[DirkB]]></dc:creator><pubDate>Sat, 01 Feb 2014 13:15:10 GMT</pubDate></item></channel></rss>