Question: I have the following code:

```
char stringHour[50], stringMinute[50], stringSecond[50];

// lots of code...
itoa(hour, stringHour, 10);
itoa(minute, stringMinute, 10);
itoa(second, stringSecond, 10);

strcat(":", stringSecond);
strcat(":", stringMinute);
strcat(stringMinute, stringSecond);
// stringHour contains both HH and :SS:MM
strcat(stringHour, stringMinute);
drawText(HRES/2 - 4, VRES - GLYPH_HEIGHT*2, 
stringHour, black);

```

`hour`, `minute` and `second` are all ints.

What I want to do is diplay time as follows: HH:MM:SS. 

The variables are guaranteed to be between 0 and 59 (except hout, 0-24).

drawText is correct.

This block of code crashes my program, and I can't find anything wrong with it. Can you?

Thanks for your time!

Answer: 
This is wrong:

```
strcat(":", stringSecond);

```

You can't use a string literal for the first argument. See [strcat](http://www.cplusplus.com/reference/clibrary/cstring/strcat/) doc.
Also - your strcat is in reverse order. strcat actually "concatenates" - so change the order.
strcat(stringHour, ":");
strcat(stringHour, stringMinute);
strcat(stringHour, ":");
strcat(stringHour, stringSecond);

However, this is pretty terrible - why not use sprintf? Also - other libraries except for string building - possibly look into the BSL. The C standard library actually has no error checking for you either - so it's a shoot yourself in the foot, unless you know exactly what you're doing and what is expected from the str\* family of functions.