Okay, I'm stumped. Can anyone see what's wrong this bit of code?:
The function "array2d_get" simply returns an int, and "array" is a structure defined earlier. When I try to run this code I get random crashes and unpredictable output, can anyone see the problem? The crashes all go away if I remove the strcat line...Code:int c, r , t; char *str; char[10] tmp; for (r=0; r<array->rows; r++) { for (c=0; c<array->columns; c++) { t = array2d_get(array, c, r); sprintf(tmp, "%d ", t); str = strcat(str, tmp); } } printf("%s", str);
Thanks![]()



LinkBack URL
About LinkBacks




) could come up with a better solution...