String^ error() {
String ^x= "penis";
String ^y= "wurst";
return x,y;
}
and then
MessageBox::Show(error()) its work but it just shows wurst the place for penis is empty
return x,y; returns y, the comma here is the so-called "comma operator", primarily used in for loops (to do "for (i = 0, j = len; i < j; i++, j--)" and such). It returns the second argument.
Doesn't the fact that your function is declared as returning String^, not the pair of strings, make you think?
If you want to return a single string, but composed of two strings, do just that, return x + " " + y.
Also, please use code tags.
Name:
Anonymous2011-05-30 8:13
the place for penis is empty
Name:
Anonymous2011-05-30 8:16
hax u anus u se.. wait wut a serious answer a noob question didnt expect that well dont know any more what u do in that case xht?
Name:
Anonymous2011-05-30 9:41
>>2
"Doesn't the fact that your function is declared as returning String^, not the pair of strings, make you think?"
You shouldn't be preaching about how peoople should "think" since you are mixing up a function declaration and its definition.
Name:
Anonymous2011-05-30 9:54
>>2
"return x,y; returns y, the comma here is the so-called "comma operator", primarily used in for loops (to do "for (i = 0, j = len; i < j; i++, j--)" and such). It returns the second argument."
Also, I believe the correct term for the "comma operator" is the "sequence point".
>>6 In C and C++, sequence points occur in the following places. [list of example expressions that do not use commas exclusively]
The comma operator is a sequence point, not the sequence point.
Name:
Anonymous2011-05-30 10:10
>>9
And what happens when I do something like the following
int a = 1;
int b = 2;
a,b;
Wouldn't the "comma operator" be the sequence point since there is only one fucking comma?
Name:
Anonymous2011-05-30 10:12
>>9
By the way, I don't know if the moron that was telling the OP to "think" is trolling or is just plain stupid.
>>10
It is indeed the only sequence point in that particular example. But calling it 'the' sequence point everywhere is wrong, as the or in a || b is also a sequence point, as the article in >>6 clearly states.
Name:
Anonymous2011-05-30 10:25
>>12
And calling it a sequence point is also wrong. This is evident by the fact that the wording omits both "the" and "a".