<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>Comments on: Can i initialize an union members like structure???if yes then why i am getting so much warning in the following programm????</title>
	<atom:link href="https://www.emblogic.com/blog/07/can-i-initialize-an-union-members-like-structureif-yes-then-why-i-am-getting-so-much-warning-in-the-following-programm/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.emblogic.com/blog/07/can-i-initialize-an-union-members-like-structureif-yes-then-why-i-am-getting-so-much-warning-in-the-following-programm/</link>
	<description>Embedded System and ARM Training</description>
	<lastBuildDate>Mon, 07 Oct 2013 04:00:03 +0000</lastBuildDate>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
	<item>
		<title>By: hemant.kumar</title>
		<link>https://www.emblogic.com/blog/07/can-i-initialize-an-union-members-like-structureif-yes-then-why-i-am-getting-so-much-warning-in-the-following-programm/#comment-947</link>
		<dc:creator><![CDATA[hemant.kumar]]></dc:creator>
		<pubDate>Sun, 08 Jul 2012 16:46:17 +0000</pubDate>
		<guid isPermaLink="false">http://emblogic.org/blog/?p=3832#comment-947</guid>
		<description><![CDATA[Union is like a chunk of memory that is used to store variables of different types. Once a new value is assigned to a field, the existing data is wiped over with the new data.
as far as i know you have to initialize each value separately
#include
#include

union logic
{
        int i;
        int x;
        char j[12];
}emb;

int main()
{
                emb.i=10;
        //      emb.x=12; 
                printf(&quot;value is %d \n&quot;,*(&amp;(emb.i)));
                emb.x=12;
                printf(&quot;address of i is %p and x is %p \n&quot;,&amp;(emb.i),&amp;(emb.x));
                printf(&quot;value is %d \n&quot;,*(&amp;(emb.x)));

                strcpy(emb.j,&quot;hello world&quot;);
                printf(&quot;%s\n&quot;,emb.j);
                printf(&quot;address is %p \n&quot;,&amp;(emb.j));
return 0;
}
but ask SIR about this concept                                                                                                                                                                       
~]]></description>
		<content:encoded><![CDATA[<p>Union is like a chunk of memory that is used to store variables of different types. Once a new value is assigned to a field, the existing data is wiped over with the new data.<br />
as far as i know you have to initialize each value separately<br />
#include<br />
#include</p>
<p>union logic<br />
{<br />
        int i;<br />
        int x;<br />
        char j[12];<br />
}emb;</p>
<p>int main()<br />
{<br />
                emb.i=10;<br />
        //      emb.x=12;<br />
                printf(&#8220;value is %d \n&#8221;,*(&amp;(emb.i)));<br />
                emb.x=12;<br />
                printf(&#8220;address of i is %p and x is %p \n&#8221;,&amp;(emb.i),&amp;(emb.x));<br />
                printf(&#8220;value is %d \n&#8221;,*(&amp;(emb.x)));</p>
<p>                strcpy(emb.j,&#8221;hello world&#8221;);<br />
                printf(&#8220;%s\n&#8221;,emb.j);<br />
                printf(&#8220;address is %p \n&#8221;,&amp;(emb.j));<br />
return 0;<br />
}<br />
but ask SIR about this concept<br />
~</p>
]]></content:encoded>
	</item>
</channel>
</rss>
