Char and int concatenation?
Posted: Mon May 20, 2013 2:24 pm
I am looking for ways to optimize my functions using more logical code. All I want to do is assemble the correct line for setting defense of an item.
Currently I have this:
However it seems to give random numbers as the result, any reason for this?
Currently I have this:
- Code: Select all
const char *name = "item";
const char *param = ".defense";
char buf[32];
sprintf( buf, "%s%d%s", name, selectedItem, param );
defense = buf;
However it seems to give random numbers as the result, any reason for this?