Good day!
I have already created a topic about function pointer and with colleagues figured out how from the description. Even wrote a structure for the console command interpreter.
However, I can not describe the function, which has one argument - a pointer to a function. Syntax C/C++ is normally allows.
void
setup ()
{
subfunc ("sssssssssssss", &strprint);
}
void
loop ()
{
}
int
subfunc (char *str, int (*func)(char *))
{
func (str);
return (0);
}
int
strprint (char *str)
{
Serial.print ("[");
Serial.print (str);
Serial.println ("]");
return (0);
}
When compiling my 0022 wrote:
sketch_apr23b.cpp: In function 'void setup()':
sketch_apr23b:7: error: 'subfunc' was not declared in this scope
I believe that I am describing the function, so that 0022 does not recognize subfunc() as function.
What am I doing wrong?
Ogogon.