here is my code, I find "each" macro only iterate first element and output "s1", how to make it iterate all elements?
#include "stdio.h"
#define each(item, array) \
for (int keep = 1, count = 0, size = sizeof(array) / sizeof *(array); keep && count != size; keep = !keep, count++) \
for (item = array[count]; keep; keep = !keep)
char *join(char const *ss[]) {
char *r = "";
each(char *s, ss) {
puts(s);
}
return (r);
}
int main(int argc, char **argv) {
char const *ss[] = {"s1", "s2"};
join(ss);
};