|
From: aruperez <arm...@gm...> - 2008-08-19 18:58:43
|
I'm using valgrind a in'm having a little problem, I'm using the function sprintf to convert an int to a char * if you check the example how to use this function in www.cppreference.com there is something like this char result[100]; int num = 24; sprintf( result, "%d", num ); however when i do that in my code, valgrind reports the following error ==16490== Use of uninitialised value of size 4 ==16490== at 0x43876E4: __printf_fp (in /lib/libc-2.6.1.so) ==16490== by 0x4382FE0: vfprintf (in /lib/libc-2.6.1.so) ==16490== by 0x439E91B: vsprintf (in /lib/libc-2.6.1.so) ==16490== by 0x438A42D: sprintf (in /lib/libc-2.6.1.so) what should i do?? initialize the char[] before calling the function?, which is the best way to do it becuase i tried assigning = "" but valgrind still complained. thanks for your help. AR -- View this message in context: http://www.nabble.com/Initialize-a-char---to-use-sprintf-function-tp19056515p19056515.html Sent from the Valgrind - Users mailing list archive at Nabble.com. |