>>158 こんな感じでやるといいのでは
#include<stdio.h>
#define N 3
void show(const int hoge[])
{
int i;
for(i = 0; i < N; i ++) printf("%d ", hoge[i]);
printf("\n");
}

int main()
{
static const int hoge_min[N] = {0,0,0};
static const int hoge_max[N] = {2,4,9};
int hoge[N], i;
for(i = 0; i < N; i ++) hoge[i] = hoge_min[i];
while(hoge[0] != hoge_max[0]) {
show(hoge);
for(i = N-1; i >= 0; i --)
if(hoge[i]++ == hoge_max[i])
hoge[i] = hoge_min[i];
else
break;
}
return 0;
}