milan.rajik
Banned
- Joined
- Apr 1, 2013
- Messages
- 2,524
- Helped
- 540
- Reputation
- 1,078
- Reaction score
- 524
- Trophy points
- 1,393
- Activity points
- 0
Is this correct? Passing function pointer to a function
I am using mikroC PRO PIC. I need to pass address of strcat() function to concat() function. Is my code correct?
mikroC library help file says... (see image)
Watch window show these before and after executing concat() function.
I am using mikroC PRO PIC. I need to pass address of strcat() function to concat() function. Is my code correct?
mikroC library help file says... (see image)
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 char msg1[]; char msg2[] = "elektronika"; char *cptr = 0; char *concat(char *(*strCatFuncPtr)(char *, char *), char *str1, char *str2){ return (*strCatFuncPtr)(str1, str2); } void main(){ while(1){ msg1[0] = 'm'; msg1[1] = 'i'; msg1[2] = 'k'; msg1[3] = 'r'; msg1[4] = 'o'; msg1[5] = '\0'; cptr = concat(&strcat, &msg1, &msg2); } }
Watch window show these before and after executing concat() function.
Attachments
Last edited: