From C99, declaring variables are allowed inside for loop.
for(int i=0; i < n ; ++i){ printf("%d ",i) }