+ 4

Can a macro use a function as parameter?

How can we make a pointer to a function in a macro? I am unable to design such a macro. Please Help!

5th Apr 2017, 1:29 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
2 Answers
+ 4
#define Foreach_string(iterator, ...) \ for (char **iterator = (char*[ ] ) { __VA_ARGS__, NULL}; *iterator; iterator++) inside main() you use it as... Foreach_string(i, "someString", str, "someOtherString"){ ///... other statements }
5th Apr 2017, 9:05 AM
Renjith M
Renjith M - avatar
+ 6
Thank You!!
5th Apr 2017, 9:09 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar