Hello,
I'm wondering if I can list contents in an array within a function argument?
For instance:
Code:
RetreiveArrayInput({2, 1, 3, 0xFF});
I have devised the following code to experiment with, but unfortunately I don't exactly know what I'm doing.
Code:
#include <stdio.h>
//** Defines ************************************************************
#define TERMINATOR 0xFF
//** Globals ************************************************************
unsigned int ArrayOfMyLife[] = {0x01, 0x02, 0x04, 0x08};
void RetreiveArrayInput(unsigned int *OrderOfValues)
{
unsigned int i;
unsigned int index;
while((index = *OrderOfValues++) != TERMINATOR)
{
for(i = ArrayOfMyLife[index]; i > 0; i--)
{
printf("Selection: %s\n", i);
}
}
}
int main()
{
unsigned int someArray[5];
RetreiveArrayInput({2, 1, 3, 0xFF});
system("PAUSE");
}
Just in case, I'm using Dev-C++.
Thanks!