Hi again,
i'm having problems with functions without an exact number of parameters. This is my code:
byte *add_position(const char *fmt, ...) {
va_list ap;
int size, index;
byte *posarray;
size = get_fmt_size(fmt);
posarray = (byte *)calloc(size, 1);
va_start(ap, fmt);
for(index=0; index<size; index++) {
posarray[index] = va_arg(ap, byte);
}
va_end(ap);
return posarray;
}
You can see that I use calloc and va_xxx family of functions. I really didn't know i could use them since i saw on Matrix.cpp shipped with arduino distribution. What are all the libraries i can use with arduino? Is it documented?
My problem is compiling that code, it gives the following message:
In function `byte* add_position(const char*, ...)':
note: if this code is reached, the program will abort
and "va_start(ap, fmt);" is highlighted.
What's the problem?