int main() { char *test[30]; int i; test[0] = "aaa;"; test[1] = "bbb;"; test[2] = "ccc;"; test[3] = "ddd;"; test[4] = "eee;"; test[5] = "fff;"; test[6] = "ggg;"; test[7] = "hhh;"; for(i = 0; i < 5; i++) { printf("INSERT INTO foo (v1,v2,v3,v4) VALUES (\"%s\", \"%s\", \"%s\", \"%s\")\n", test[i], test[i+1], test[i+2], test[i+3]); (i++) + 1; }