<?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[problem mit speicherallozierung eines C-String array]]></title><description><![CDATA[<p>nabend leute,</p>
<p>wie kann ich folgendes realisieren (nur ein bsp.)?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cstring&gt;
using namespace std;
int main(int argc, char **argv)
{
    if(argc&lt;=1) return EXIT_FAILURE;
    char** ptr=new char* [argc];
    for (int i=0;i&lt;argc;i++)
    {
        char ptr[i]=new char[strlen(argv[i])];
    };
};
</code></pre>
<p>&quot;variable-sized object `ptr' may not be initialized&quot; lautet die fehlermeldung. jetzt möchte ich aber für jedes element der ersten dimension speicher für jeweils ein neues array anfordern. allerdings sind diese arrays der zweiten dimension immer verschiedengroß. das dürfte doch eigentlich problemlos so gehn oder nicht?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/170913/problem-mit-speicherallozierung-eines-c-string-array</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 05:33:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/170913.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 20 Jan 2007 20:16:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to problem mit speicherallozierung eines C-String array on Sat, 20 Jan 2007 20:16:56 GMT]]></title><description><![CDATA[<p>nabend leute,</p>
<p>wie kann ich folgendes realisieren (nur ein bsp.)?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cstring&gt;
using namespace std;
int main(int argc, char **argv)
{
    if(argc&lt;=1) return EXIT_FAILURE;
    char** ptr=new char* [argc];
    for (int i=0;i&lt;argc;i++)
    {
        char ptr[i]=new char[strlen(argv[i])];
    };
};
</code></pre>
<p>&quot;variable-sized object `ptr' may not be initialized&quot; lautet die fehlermeldung. jetzt möchte ich aber für jedes element der ersten dimension speicher für jeweils ein neues array anfordern. allerdings sind diese arrays der zweiten dimension immer verschiedengroß. das dürfte doch eigentlich problemlos so gehn oder nicht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213402</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213402</guid><dc:creator><![CDATA[bill bones]]></dc:creator><pubDate>Sat, 20 Jan 2007 20:16:56 GMT</pubDate></item><item><title><![CDATA[Reply to problem mit speicherallozierung eines C-String array on Sat, 20 Jan 2007 20:26:17 GMT]]></title><description><![CDATA[<p>Lass das &quot;char&quot; am Anfang von Zeile 10 weg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213409</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213409</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Sat, 20 Jan 2007 20:26:17 GMT</pubDate></item><item><title><![CDATA[Reply to problem mit speicherallozierung eines C-String array on Sat, 20 Jan 2007 20:55:02 GMT]]></title><description><![CDATA[<p>mist das hab ich wohl übersehn...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213417</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213417</guid><dc:creator><![CDATA[bill bones]]></dc:creator><pubDate>Sat, 20 Jan 2007 20:55:02 GMT</pubDate></item></channel></rss>