if have use the following code
[\code]int i = 81;
char str[10];
sprintf(str, "%s", i);[code]
when i run the program nothing happens. It compiles fine but there is no output
if have use the following code
[\code]int i = 81;
char str[10];
sprintf(str, "%s", i);[code]
when i run the program nothing happens. It compiles fine but there is no output
And what, exactly, do you expect to be output? There is nothing in your code to perform such output - and you got the code-tags the wrong way around the one with the slash should be at the end.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Where do you actually populate str?
And I don't think that's the correct call of sprintf(), but I'm unsure from memory.
My bad guys. I found the problem. Wasnt supposed to be a string, jus a char. I have it now.
Maybe "%d" instead of "%s" would help?