char buf[10];

for(10){
case 0:
  buf[0]=0;
  break;
case 1:
  buf[1]=1;
  break;
...
}