<?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>subtraction of 2 ascii arrays</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/27098/subtraction-of-2-ascii-arrays</link><description> 
Hey i wants to get idea for how to subtact two arrays of ascii
chracters of amount.... 

 
e.g. 

 
unsigned char ary1[3],ary2[3],ary[3]; 

 
ary1[1]=0x32; //0x32 is ascii code for 2 
ary1[2]=0x31; //same 0x31 is ascii code of 1 
ary1[3]=0x34; 

 
ary2</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: subtraction of 2 ascii arrays</title><link>https://community.arm.com/thread/139739?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2010 16:19:30 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4efe50a9-a207-49e7-965e-4d4fe1c4cb72</guid><dc:creator>Per Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Binary, octal, decimal, hexadecimal, ...&lt;/p&gt;

&lt;p&gt;
Just different way of presenting a number.&lt;/p&gt;

&lt;p&gt;
But the binary number 10001 is still the same number as the octal
number 21, the decimal number 17 or the hexadecimal number 11.&lt;/p&gt;

&lt;p&gt;
And next thing - having each array entry store ASCII &amp;#39;2&amp;#39; or just 2
doesn&amp;#39;t really change the way you perform the subtract, since &amp;#39;0&amp;#39; + 2
= &amp;#39;2&amp;#39;. Having an arbitrary (but constant) offset added to all digits
_only_ requires you to make sure that the variables you use are big
enough to store the numbers. When you make the offsets large enough,
you will no longer be able to work with 8-bit variables. But an ASCII
digit obviously do fit in an 8-bit variable.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtraction of 2 ascii arrays</title><link>https://community.arm.com/thread/136315?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2010 15:06:24 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f6b6d548-451f-44fb-accd-3ae5a8145135</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;

&lt;a href="http://online.edfac.unimelb.edu.au/485129/wnproj/subtract/algorith.htm"&gt;online.edfac.unimelb.edu.au/.../algorith.htm&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtraction of 2 ascii arrays</title><link>https://community.arm.com/thread/126480?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2010 14:14:19 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:42f7e475-468d-4ae3-81f2-51a35a47cb52</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;but then problem is that how to subtract arrays of hex
numbers.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Eh???&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;quot;direct subtraction rather then char wise subtraction&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Eh???&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;quot;forwarding carry to next.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
How many times does it have to be said: &lt;b&gt;think about how you
would do this manually with pencil and paper.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
If you don&amp;#39;t understand the basics of how to do it yourself, how
can you hope to implement it in a program??&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtraction of 2 ascii arrays</title><link>https://community.arm.com/thread/116096?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2010 12:01:35 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b3fa9d1b-ed6a-49ac-8e0a-8d436e32533a</guid><dc:creator>Ankit lathigira</dc:creator><description>&lt;p&gt;&lt;p&gt;
Yes... i thought for ascii conversion to hex but then problem is
that how to subtract arrays of hex numbers...&lt;/p&gt;

&lt;p&gt;
Thats y i want 2 know about direct subtraction rather then char
wise subtraction and then forwarding carry to next..&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtraction of 2 ascii arrays</title><link>https://community.arm.com/thread/116097?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2010 11:03:07 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6c0902b1-4281-437e-85be-504e383695b9</guid><dc:creator>Per Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
By the way - don&amp;#39;t write:&lt;/p&gt;

&lt;pre&gt;
ary1[1]=0x32; //0x32 is ascii code for 2
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
when it&amp;#39;s easier to read (and no need for the comment).&lt;/p&gt;

&lt;pre&gt;
ary1[1]=&amp;#39;2&amp;#39;;
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtraction of 2 ascii arrays</title><link>https://community.arm.com/thread/104353?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2010 10:34:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:94967383-90cb-4f9b-a799-afdef6e21a88</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
No, you will not be handed a ready-done solution on a plate -
&lt;b&gt;you&lt;/b&gt; need to &lt;b&gt;think&lt;/b&gt; for &lt;b&gt;yourself!&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
Have you actually &lt;b&gt;thought&lt;/b&gt; about the suggestions given so
far?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtraction of 2 ascii arrays</title><link>https://community.arm.com/thread/78764?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2010 10:09:48 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:36099835-9fa9-4bd1-90af-dd8f9214f937</guid><dc:creator>Ankit lathigira</dc:creator><description>&lt;p&gt;&lt;p&gt;
But how to subtract two arrays of integers...&lt;br /&gt;
Is there any solution??&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtraction of 2 ascii arrays</title><link>https://community.arm.com/thread/65985?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2010 03:47:24 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:341aa8a6-4d41-43c9-b7ca-a078bec58983</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
As Per says, just think about how you would do this &amp;quot;manually&amp;quot;
using pencil and paper...&lt;/p&gt;

&lt;p&gt;
Or, convert the text strings to numbers, and do the arithmetic on
the numbers using the standard &amp;#39;C&amp;#39; arithmetic operators...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtraction of 2 ascii arrays</title><link>https://community.arm.com/thread/90694?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2010 02:46:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:9c41a218-4daa-4db8-be71-4bf950f75060</guid><dc:creator>Per Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Addendum: you normally borrow for subtraction. But same principle.
How do you do it with pen and paper.&lt;/p&gt;

&lt;p&gt;
And it&amp;#39;s easier if you work with the digits in binary form 0..9
instead of ASCII form. But if you just remember the offset between
binary form and ASCII form (you have two offsets - one for each
digit) it still isn&amp;#39;t that hard.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtraction of 2 ascii arrays</title><link>https://community.arm.com/thread/58826?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2010 02:41:42 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:52f40e0d-3e67-481c-b98e-05931db6961f</guid><dc:creator>Per Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
How would you handle carry if this was two lines of digits you
handled with pen and pencil.&lt;/p&gt;

&lt;p&gt;
By the way - why do you think array entries starts with index
1?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>