Name:
Anonymous
2008-03-20 20:57
Hey /prog/, is there any way to pass an anonymous array into a function in Sepples? For example, something like:
set_magic_numbers( { 2, 3, 5 } );
Name:
Anonymous
2008-03-21 2:07
anonymous array? what?
im not sure what you mean, but this is how you pass a normal array
#include<iostream>
using namespace std;
void whateverFunction (int[]);
void main()
{
int someArray[]={1,2,3,4,5};
whateverFunction (someArray);
}
void whateverFunction (int someArray[])
{
//do whatever the function does
}
Name:
Anonymous
2008-03-21 2:13
>>7
Why do we have to name it, sepples user?
Name:
Anonymous
2008-03-21 2:14
>>7
He means passing it without creating some useless variable. And the answer is: array literals in your Sepples? Of course not, use a real language.