multi-argument function pointer and enum
Hi,
I have two main questions:
1. How to design a function pointer that can deal with various types of functions ?
For example, I have a function that receive 3 arguments. I tried to assign it to a function pointer which worked by assigning and one typecasting, but when calling the function pointer, I couldn't pass the 3 arguments as in the original function.
This is my example:
Code:
void (*fun_ptr)(void *);
void write_chars(uint8_t row, uint8_t col, char *str){ str_ptr = str;
uint8_t i;
i = strlen(str_ptr);
printf("size of string is %d\n",i);
printf("%s",str_ptr);
fun_ptr = (void*)&write_chars;
}
int main(){
fun_ptr((void*)1,(void*)1,(void*)"messaage1");
return 0;
}
2. What is the difference between and just in libraries ? And does it put any difference when using it in another library?
Almost +%90 of libraries files I open are using typedef, but I don't know why.