user5069: I have written a code for my Arduino which spans multiple files, In the file containing the main task, i have a Global Array like this
addr_t childAddr[NUM_CHILDS] = { CHILD1_I2C_ADDR, CHILD2_I2C_ADDR };

where
#define NUM_CHILDS  0x02
#define CHILD1_I2C_ADDR         0x10
#define CHILD2_I2C_ADDR         0x02

Now to debug my issue, in my Task i do this
Serial.print(childAddr[0]);
Serial.print(childAddr[1]); 

All i receive is 
00

I looked at the issue online, someone pointed it towards overshooting the RAM, I am working on a Pro Mini with ATmega328P with 2K RAM.


user42: Since addr_t is a character type, I suspect Serial.print() is trying to output the ASCII character representation of your two values. ASCII codes 0x10 and 0x02 are non-printing characters, so it might just be outputting 0's for lack of anything better to do.
To output the data as actual numbers, try casting them to integers:

Serial.print( static_cast<unsigned int>(childAddr[0]) );
Serial.print( static_cast<unsigned int>(childAddr[1]) );


5069: <p>I have written a code for my Arduino which spans multiple files, In the file containing the main task, i have a Global Array like this</p>

<pre><code>addr_t childAddr[NUM_CHILDS] = { CHILD1_I2C_ADDR, CHILD2_I2C_ADDR };
</code></pre>

<p>where</p>

<pre><code>#define NUM_CHILDS  0x02
#define CHILD1_I2C_ADDR         0x10
#define CHILD2_I2C_ADDR         0x02
</code></pre>

<p>Now to debug my issue, in my Task i do this</p>

<pre><code>Serial.print(childAddr[0]);
Serial.print(childAddr[1]); 
</code></pre>

<p>All i receive is </p>

<pre><code>00
</code></pre>

<p>I looked at the issue online, someone pointed it towards overshooting the RAM, I am working on a Pro Mini with ATmega328P with 2K RAM.
<img src="https://i.stack.imgur.com/xovDm.png" alt="This is my Output for analyzing the eld with &quot;avr-size&quot;  utility"></p>
 42: <p>Since <code>addr_t</code> is a character type, I suspect <code>Serial.print()</code> is trying to output the ASCII character representation of your two values. ASCII codes 0x10 and 0x02 are non-printing characters, so it might just be outputting 0's for lack of anything better to do.</p>

<p>To output the data as actual numbers, try casting them to integers:
</p>

<pre><code>Serial.print( static_cast&lt;unsigned int&gt;(childAddr[0]) );
Serial.print( static_cast&lt;unsigned int&gt;(childAddr[1]) );
</code></pre>
