A couple of work arounds, maybe:
Code:
#include <stdio.h>
#include <string.h>
int main() {
int i;
int num[4] = { 1000, 100, 10, 1 };
char spc[4] = {""};
printf("\n\n");
for(i=0;i<4;i++) {
printf("\n%d: %s%d", i, spc, num[i]);
spc[i] = ' ';
}
printf("\n\n\n");
spc[0]=spc[1]=spc[2]=spc[3]='\0'; //reset the space array
for(i=0;i<4;i++) {
if(num[i] > 999)
spc[0]='\0';
else if(num[i] > 99)
spc[0]=' ';
else if(num[i] > 9)
strcpy(spc, " ");
else
strcpy(spc, " ");
printf("\n%d: %s%d", i, spc, num[i]);
spc[i]='\0';
}
printf("\n\n\t\t\t press enter when ready");
i = getchar(); ++i;
return 0;
}
@LordPc - Welcome to the Forum!
Hey, I think we could use a righteous contributor.