strcat outputs garbage

Anyone have any ideas why when using strcat function I would get some garbage at the beginning of the output string? what I'm doing is something like the following example.

Code:

char temp[32];
char tempHolder[32];

for(int i=0;i<something;i++){
sprintf(temp,"%u ", someVariable);
strcat(tempHolder,temp);
}

printf("%s\n",tempHolder);

Output:
Ao8@<the rest of my string prints after>

You need to initilaize your strings

char temp[32]={0x0};
char tempHolder[32]={0x0};

The reason strcat() "messes up" is because there were pre-existing garbage bytes on the stack where temp was allocated. strcat moved on past the garbage to the first '\0' byte to write the content of tempHolder.

awesome that worked thanks for the help Jim. I thought I had tried something similar to that but I guess I was doing it wrong.