<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>printf anomaly</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/17062/printf-anomaly</link><description> I have an array 
 
unsigned char v[4]
 
The 4 elements contain ASCII numerical characters that are the result of various calculations and the contents of the array is in the form: - 
x.xx (in other words v[1]is always &amp;#39;.&amp;#39;) 
If I then use the instruction</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: printf anomaly</title><link>https://community.arm.com/thread/42612?ContentTypeID=1</link><pubDate>Tue, 10 Aug 2004 05:18:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:bcb3d101-f69a-410d-ac1f-c77c8094fdf4</guid><dc:creator>clever dick</dc:creator><description>&lt;p&gt;Your string is not terminated.  Make is 5 bytes and put v[4]=&amp;#39;\0&amp;#39;&lt;br /&gt;
&lt;br /&gt;
Printf has no idea your string is only 4 characters long as all is sees is a pointer.&lt;br /&gt;
&lt;br /&gt;
Instead changing %s to %.4s might limit printf the showing the first 4 charactors&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>