Ist es in C++ möglich, Funktions-Inout-Parameter mit Standardwert zu übergeben?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Ist es in C++ möglich, Funktions-Inout-Parameter mit Standardwert zu übergeben?

by Anonymous » 17 Jan 2025, 07:56

Können wir eine Funktion in C++ schreiben, so etwas, vielleicht nicht ganz so, die Syntax kann anders sein

Code: Select all

void FunctionTest(int param1, _Inout_ int& param2 = 10)
{
param2 = 20;
}

int main() {
int a = 100, int b = 200;
FunctionTest(10);
FunctionTest(a, b);
}
Es ist nicht notwendig, dass es als Referenz übergeben wird, möglicherweise funktioniert auch eine andere Alternative als Zeiger oder auf andere Weise.

Top