We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Dear All,
In my coding , by mistaken i used printf() function instead of sprintf().... but my code compile ....but not running....
but after replacing sprintf() function ....my code is working fine.
Can any explain be what happen?
Thanks in Advance.
1) You may not have configured your code to know where to send data from printf(). Does printf() work in other parts of your code?
2) printf() takes a formatting string as first argument. sprintf() takes a destination buffer as first argument and the formatting string as second argument. How fun for printf() to get a buffer of random content as formatting string.
3) printf() wants to emit data, which means that printf() can require a lot of time while waiting for a serial port to consume the data. This may break a program that needs the call to be quick. sprintf() don't need to synchronize with any I/O - it just leaves the result in a buffer.