(try implementing a macro on the level of loop in te C preprocessor)
#define sum(i,acc) acc+=i;
#define loop(x,y,func) ({int acc=0;for(int i=x;i<y;i++){func(i,acc);}acc;})
#define sumloop(x,y) loop(x,y,sum)
the above is (loop for i from 1 to 10 sum)
>>47
Alternative
#include <stdio.h>
int main(){
#define sum(i,acc) acc+=i
#define loop(x,y,acc,func) ({for(int i=x;i<=y;i++){func(i,acc);}acc;})
#define sumloop(x,y) ({int acc=0;loop(x,y,acc,sum);})
printf("%d",sumloop(1,10));
}