<?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[sizeof()]]></title><description><![CDATA[<p>Hi!</p>
<p>Eine kleine Beginnerfrage:</p>
<pre><code>char *buffer;
buffer = (char*)malloc(10);
int test = sizeof(buffer); //test ist immer 4, warum???
</code></pre>
<p>Sollte mir sizeof() nicht die Größe des verbrauchten Speicherbereichs zurückliefern? Also 10?</p>
<p>Vielen dank für eure Hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/233835/sizeof</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 15:28:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/233835.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 09 Feb 2009 19:13:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to sizeof() on Mon, 09 Feb 2009 19:13:40 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>Eine kleine Beginnerfrage:</p>
<pre><code>char *buffer;
buffer = (char*)malloc(10);
int test = sizeof(buffer); //test ist immer 4, warum???
</code></pre>
<p>Sollte mir sizeof() nicht die Größe des verbrauchten Speicherbereichs zurückliefern? Also 10?</p>
<p>Vielen dank für eure Hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1660746</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1660746</guid><dc:creator><![CDATA[C_Cheaf]]></dc:creator><pubDate>Mon, 09 Feb 2009 19:13:40 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof() on Mon, 09 Feb 2009 19:16:32 GMT]]></title><description><![CDATA[<p>sizeof(buffer) liefert dir die Größe des Datentyps von buffer in Bytes. Das ist char*, also in dem Fall 4.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1660750</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1660750</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Mon, 09 Feb 2009 19:16:32 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof() on Mon, 09 Feb 2009 19:33:37 GMT]]></title><description><![CDATA[<p>Ok, und wie kann man nun die 10 Byte ermitteln?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1660759</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1660759</guid><dc:creator><![CDATA[C_Cheaf]]></dc:creator><pubDate>Mon, 09 Feb 2009 19:33:37 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof() on Mon, 09 Feb 2009 19:35:55 GMT]]></title><description><![CDATA[<p>Leider gar nicht. Höchstens vielleicht mit irgendwelchen Funktionen, die von Compiler zu Compiler anders heißen. Der übliche Weg ist, dass man sich die Länge eines allozierten Feldes in einer separaten Variable speichert. Oder, noch häufiger, man packt den Zeiger und die Länge zusammen in eine Klasse. So wie std::vector.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1660760</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1660760</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Mon, 09 Feb 2009 19:35:55 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof() on Mon, 09 Feb 2009 19:47:55 GMT]]></title><description><![CDATA[<p>Gut zu wissen!</p>
<p>Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1660764</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1660764</guid><dc:creator><![CDATA[C_Cheaf]]></dc:creator><pubDate>Mon, 09 Feb 2009 19:47:55 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof() on Tue, 10 Feb 2009 07:28:50 GMT]]></title><description><![CDATA[<p>eigene string klasse schreiben. kann spass machen und man lernt was</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1660890</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1660890</guid><dc:creator><![CDATA[gummihose]]></dc:creator><pubDate>Tue, 10 Feb 2009 07:28:50 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof() on Tue, 10 Feb 2009 09:13:31 GMT]]></title><description><![CDATA[<p>Du kannst dir auch einfach merken wieviel Byte du allokiert hast. Z.B. als Paar von Zeiger und Speichergroesse.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1660936</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1660936</guid><dc:creator><![CDATA[knivil]]></dc:creator><pubDate>Tue, 10 Feb 2009 09:13:31 GMT</pubDate></item></channel></rss>