hello I have a code like the one below
char *str ;
strcpy(str, \"\\t<\");
strcat(str, time);
strcat(str, \">[\");
strcat(s
You don't allocate memory and you leave str
uninitialized. All later writes are done through an uninitialized pointer that points "somewhere" - that's undefined behavior.
You have to allocate (and later free) memory large enough to hold the resulting string:
char *str = malloc( computeResultSizeSomehow() );
if( str == 0 ) {
// malloc failed - handle as fatal error
}
//proceed with your code, then
free( str );