<?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[Zeiger auf float Array an Funktion]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich komm hier nicht weiter, wie übergebe ich einen Zeiger auf ein float array an eine Funktion um es dort zu verändern und dann in der aufrufenden Funktion zu verarbeiten ?</p>
<p>Das hab ich probiert, aber das funktioniert so nicht:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------
// CPP-Datei

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
 int   iIndex;
 float fSize[2];

 iIndex = 0;
 Funktion( iIndex, &amp;fSize );

 Label1-&gt;Caption = FloatToStr(fSize[0]);
 Label2-&gt;Caption = FloatToStr(fSize[1]);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Funktion(int iIndex, float *fSize[])
{
 switch( iIndex )
  {
   case 0: fSize[0] = 21.0;
           fSize[1] = 29.7;
           break;
   case 1: fSize[0] = 29.7;
           fSize[1] = 42.0;
           break;
  // ...
  }
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
// Header-Datei

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// Von der IDE verwaltete Komponenten
        TButton *Button1;
        TLabel *Label1;
        TLabel *Label2;
        void __fastcall Button1Click(TObject *Sender);
private:	// Anwender-Deklarationen
        void Funktion( int, float** );
public:		// Anwender-Deklarationen
        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
</code></pre>
<p>Was mach ich falsch ?</p>
<p>Vielen Dank für eure Hilfe!</p>
<p>Gruß WoWe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/90361/zeiger-auf-float-array-an-funktion</link><generator>RSS for Node</generator><lastBuildDate>Mon, 06 Jul 2026 18:36:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/90361.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 28 Oct 2004 15:38:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 15:38:02 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich komm hier nicht weiter, wie übergebe ich einen Zeiger auf ein float array an eine Funktion um es dort zu verändern und dann in der aufrufenden Funktion zu verarbeiten ?</p>
<p>Das hab ich probiert, aber das funktioniert so nicht:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------
// CPP-Datei

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
 int   iIndex;
 float fSize[2];

 iIndex = 0;
 Funktion( iIndex, &amp;fSize );

 Label1-&gt;Caption = FloatToStr(fSize[0]);
 Label2-&gt;Caption = FloatToStr(fSize[1]);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Funktion(int iIndex, float *fSize[])
{
 switch( iIndex )
  {
   case 0: fSize[0] = 21.0;
           fSize[1] = 29.7;
           break;
   case 1: fSize[0] = 29.7;
           fSize[1] = 42.0;
           break;
  // ...
  }
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
// Header-Datei

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// Von der IDE verwaltete Komponenten
        TButton *Button1;
        TLabel *Label1;
        TLabel *Label2;
        void __fastcall Button1Click(TObject *Sender);
private:	// Anwender-Deklarationen
        void Funktion( int, float** );
public:		// Anwender-Deklarationen
        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
</code></pre>
<p>Was mach ich falsch ?</p>
<p>Vielen Dank für eure Hilfe!</p>
<p>Gruß WoWe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/639660</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639660</guid><dc:creator><![CDATA[WoWe]]></dc:creator><pubDate>Thu, 28 Oct 2004 15:38:02 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 15:49:14 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>1. Uebergabeparameter = (int index, float fl[])<br />
2. Aufruf = Funktion( iIndex, fSize );</p>
<p>MfG<br />
Klaus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/639670</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639670</guid><dc:creator><![CDATA[KlausB]]></dc:creator><pubDate>Thu, 28 Oct 2004 15:49:14 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 16:25:53 GMT]]></title><description><![CDATA[<p>Hallo Klaus,</p>
<p>meinst du das so:</p>
<pre><code class="language-cpp">void __fastcall TForm1::Button1Click(TObject *Sender)
{
 int   iIndex;
 float fSize[2];

 iIndex = 0;
 Funktion( iIndex, fSize );

 Label1-&gt;Caption = FloatToStr(fSize[0]);
 Label2-&gt;Caption = FloatToStr(fSize[1]);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Funktion(int iIndex, float fSize[])
{
 switch( iIndex )
  {
   case 0: fSize[0] = 21.0;
           fSize[1] = 29.7;
           break;
   case 1: fSize[0] = 29.7;
           fSize[1] = 42.0;
           break;
  // ...
  }
}
// Header ---------------------------------------------------------------------
private:    // Anwender-Deklarationen
        void Funktion( int, float** );
</code></pre>
<p>Das geht auch nicht, oder hab ich dich da falsch verstanden ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/639706</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639706</guid><dc:creator><![CDATA[WoWe]]></dc:creator><pubDate>Thu, 28 Oct 2004 16:25:53 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 17:22:27 GMT]]></title><description><![CDATA[<p>WoWe schrieb:</p>
<blockquote>
<p>Das geht auch nicht, oder hab ich dich da falsch verstanden ?</p>
</blockquote>
<p>Hi,<br />
was bedeutet geht nicht?<br />
Gibt es Fehlermeldungen?</p>
<p>MfG</p>
<p>Alexander Sulfrian</p>
]]></description><link>https://www.c-plusplus.net/forum/post/639753</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639753</guid><dc:creator><![CDATA[Alexander Sulfrian]]></dc:creator><pubDate>Thu, 28 Oct 2004 17:22:27 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 18:12:49 GMT]]></title><description><![CDATA[<p>Hallo Alexander,</p>
<p>ja ich habe folgende Fehlermeldungen:</p>
<pre><code class="language-cpp">[C++ Fehler] Unit1.cpp(24): E2034 Konvertierung von 'float *' nach 'float * *' nicht möglich
[C++ Fehler] Unit1.cpp(24): E2340 Keine Übereinstimmung des Typs beim Parameter 2 ('float * *' erwartet, 'float *' erhalten)
[C++ Fehler] Unit1.cpp(32): E2316 '_fastcall TForm1::Funktion(int,float *)' ist kein Element von 'TForm1'
</code></pre>
<p>Ich bekomme das nicht auf die Reihe. Hast du noch einen Tip für mich ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/639785</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639785</guid><dc:creator><![CDATA[WoWe]]></dc:creator><pubDate>Thu, 28 Oct 2004 18:12:49 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 18:38:12 GMT]]></title><description><![CDATA[<p>warum so kompliziert? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<pre><code class="language-cpp">void __fastcall TForm1::Button1Click(TObject *Sender)
{
 int   iIndex;
 float fSize[2];

 iIndex = 0;
 Funktion( iIndex, fSize );

 Label1-&gt;Caption = FloatToStr(fSize[0]);
 Label2-&gt;Caption = FloatToStr(fSize[1]);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Funktion(int iIndex, float *fSize)
{
 switch( iIndex )
  {
   case 0: fSize[0] = 21.0;
           fSize[1] = 29.7;
           break;
   case 1: fSize[0] = 29.7;
           fSize[1] = 42.0;
           break;
  // ...
  }
}
// Header ---------------------------------------------------------------------
private:    // Anwender-Deklarationen
        void __fastcall Funktion( int, float* );
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/639815</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639815</guid><dc:creator><![CDATA[Killing me softly]]></dc:creator><pubDate>Thu, 28 Oct 2004 18:38:12 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 18:43:18 GMT]]></title><description><![CDATA[<p>Hallo Alexander,</p>
<p>ja ich habe folgende Fehlermeldungen:</p>
<pre><code class="language-cpp">[C++ Fehler] Unit1.cpp(24): E2034 Konvertierung von 'float *' nach 'float * *' nicht möglich
[C++ Fehler] Unit1.cpp(24): E2340 Keine Übereinstimmung des Typs beim Parameter 2 ('float * *' erwartet, 'float *' erhalten)
[C++ Fehler] Unit1.cpp(32): E2316 '_fastcall TForm1::Funktion(int,float *)' ist kein Element von 'TForm1'
</code></pre>
<p>Ich bekomme das nicht auf die Reihe. Hast du noch einen Tip für mich ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/639826</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639826</guid><dc:creator><![CDATA[WoWe]]></dc:creator><pubDate>Thu, 28 Oct 2004 18:43:18 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 18:47:43 GMT]]></title><description><![CDATA[<p>@Killing me softly: Was ist daran so kompliziert ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/639834</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639834</guid><dc:creator><![CDATA[WoWe]]></dc:creator><pubDate>Thu, 28 Oct 2004 18:47:43 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 19:02:53 GMT]]></title><description><![CDATA[<p>void __fastcall TForm1::Funktion(int iIndex, float fSize[])<br />
oder<br />
void __fastcall TForm1::Funktion(int iIndex, float *fSize)</p>
<p>Beides funktioniert. Deine Fehlermeldung kommt daher, weil du vergessen hast die Übergabeparameter auch im Header zu ändern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/639854</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639854</guid><dc:creator><![CDATA[Killing me softly]]></dc:creator><pubDate>Thu, 28 Oct 2004 19:02:53 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 19:25:48 GMT]]></title><description><![CDATA[<p>WoWe schrieb:</p>
<blockquote>
<p>[C++ Fehler] Unit1.cpp(24): E2034 Konvertierung von 'float *' nach 'float * *' nicht möglich<br />
[C++ Fehler] Unit1.cpp(24): E2340 Keine Übereinstimmung des Typs beim Parameter 2 ('float * *' erwartet, 'float *' erhalten)<br />
[C++ Fehler] Unit1.cpp(32): E2316 '_fastcall TForm1::Funktion(int,float *)' ist kein Element von 'TForm1'</p>
</blockquote>
<p>Hi,<br />
also so wie ich das sehen, basieren alle Fehlermeldungen auf der ersten Fehlermeldung. In dieser steht das er einen gegebenen Zeiger auf ein float nicht in einen erwartetet Zeiger auf einen Zeiger auf ein float umwandeln kann. Nun suchen wir mal wo ein float * * steht?!<br />
Wir überlegen uns ob im Header tatsäschlich ein float * * stehen soll...<br />
Eigentlich sollte im Header und in der Cpp die Parameter übereinstimmen. Du solltes also im Header aus dem float * * ein float * machen...<br />
Der zweite Fehler sagt nun aus, das der Parameter im Funktionsaufruf nicht mit der definierten Funktion übereinstimmt (resultiert daraus, dass die Typen nicht automatisch konvertierbar sind)<br />
Und der letzte Fehler sagt nochmal aus, dass der Compiler keine Funktion mit den gegebenen Parametern im Header gefunden hat. (eigentlich das gleiche wie die 2. Fehlermeldung)!</p>
<p>Du siehst also, dass man die 3 Fehlermeldungen durch das Entfernen von einem * ganz leicht beseitigen kann. Man muss nur strukturiert denken! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>MfG</p>
<p>Alexander Sulfrian</p>
]]></description><link>https://www.c-plusplus.net/forum/post/639883</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639883</guid><dc:creator><![CDATA[Alexander Sulfrian]]></dc:creator><pubDate>Thu, 28 Oct 2004 19:25:48 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 19:32:44 GMT]]></title><description><![CDATA[<p>Na jetzt komm doch mal einer auf den Punkt. Was muss ich denn im Header ändern das es funktioniert ?</p>
<p>PS Aus dem ** im Header hab ich schon * gemacht, aber trotzdem funktioniert es nicht !!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/639886</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639886</guid><dc:creator><![CDATA[WoWe]]></dc:creator><pubDate>Thu, 28 Oct 2004 19:32:44 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 19:49:24 GMT]]></title><description><![CDATA[<p>Eine funktionierende Variante (incl. Teil des Headers) hab' ich ja bereits gepostet. Und wenn du behauptest, dein Header sieht genauso aus, dann kontrollier mal, ob da nicht das __fastcall fehlt.</p>
<p>Sollte es danach immer noch nicht funktionieren, dann zeig mal, was z.Z. bei dir steht (.cpp und .h).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/639897</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639897</guid><dc:creator><![CDATA[Killing me softly]]></dc:creator><pubDate>Thu, 28 Oct 2004 19:49:24 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 20:00:59 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>also i.M. sieht es so aus (funktioniert nicht):</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
 int   iIndex;
 float fSize[2];

 iIndex = 0;
 Funktion( iIndex, fSize );

 Label1-&gt;Caption = FloatToStr(fSize[0]);
 Label2-&gt;Caption = FloatToStr(fSize[1]);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Funktion(int iIndex, float fSize[])
{
 switch( iIndex )
  {
   case 0: fSize[0] = 21.0;
           fSize[1] = 29.7;
           break;
   case 1: fSize[0] = 29.7;
           fSize[1] = 42.0;
           break;
  // ...
  }
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// Von der IDE verwaltete Komponenten
        TButton *Button1;
        TLabel *Label1;
        TLabel *Label2;
        void __fastcall Button1Click(TObject *Sender);
private:	// Anwender-Deklarationen
        void Funktion( int, float* );
public:		// Anwender-Deklarationen
        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
</code></pre>
<p>Fehlermeldung:</p>
<pre><code class="language-cpp">[C++ Fehler] Unit1.cpp(32): E2356 Redeklaration von 'TForm1::Funktion(int,float *)' mit anderem Typ
[C++ Fehler] Unit1.h(19): E2344 'TForm1::Funktion(int,float *)' bereits deklariert
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/639903</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639903</guid><dc:creator><![CDATA[WoWe]]></dc:creator><pubDate>Thu, 28 Oct 2004 20:00:59 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 20:07:31 GMT]]></title><description><![CDATA[<p>Killing me softly schrieb:</p>
<blockquote>
<p>[...]Und wenn du behauptest, dein Header sieht genauso aus, dann kontrollier mal, ob da nicht das __fastcall fehlt.[...]</p>
</blockquote>
<p>Hi,<br />
mach doch mal das was da steht....</p>
<p>MfG</p>
<p>Alexander Sulfrian</p>
<p>PS: Ich Copy&amp;Paste einfach immer die erste Zeile der Funktion aus der cpp in die h und setze dann ein ; dahinter! Hat bisher immer funktioniert....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/639905</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639905</guid><dc:creator><![CDATA[Alexander Sulfrian]]></dc:creator><pubDate>Thu, 28 Oct 2004 20:07:31 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 20:10:12 GMT]]></title><description><![CDATA[<p>Killing me softly schrieb:</p>
<blockquote>
<p>...Und wenn du behauptest, dein Header sieht genauso aus, <strong>dann kontrollier mal, ob da nicht das __fastcall fehlt</strong>.</p>
</blockquote>
<pre><code class="language-cpp">private:    // Anwender-Deklarationen
        void __fastcall Funktion( int, float [] );
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/639908</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639908</guid><dc:creator><![CDATA[Killing me softly]]></dc:creator><pubDate>Thu, 28 Oct 2004 20:10:12 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf float Array an Funktion on Thu, 28 Oct 2004 20:33:56 GMT]]></title><description><![CDATA[<p>Hey Leute,</p>
<p>vielen vielen Dank! Das mit dem &quot;__fastcall&quot; hab ich einfach übersehen ( Asche auf mein Haupt ), ist so, sorry !!!</p>
<p>Trotzdem danke das ihr mich auf die richtige Spur gebracht habt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/639924</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/639924</guid><dc:creator><![CDATA[WoWe]]></dc:creator><pubDate>Thu, 28 Oct 2004 20:33:56 GMT</pubDate></item></channel></rss>