<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Array Archives - Onestring Lab</title>
	<atom:link href="https://onestringlab.com/tag/array/feed/" rel="self" type="application/rss+xml" />
	<link>https://onestringlab.com/tag/array/</link>
	<description>Kode Kreativitas Kopi</description>
	<lastBuildDate>Mon, 04 May 2026 08:38:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://onestringlab.com/wp-content/uploads/2021/10/cropped-osl-high-res-e1455499003866-32x32.jpg</url>
	<title>Array Archives - Onestring Lab</title>
	<link>https://onestringlab.com/tag/array/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Belajar Bahasa C &#8211; Ones and Zeros</title>
		<link>https://onestringlab.com/ones-and-zero/</link>
		
		<dc:creator><![CDATA[Rajo Intan]]></dc:creator>
		<pubDate>Wed, 30 Nov 2022 10:37:35 +0000</pubDate>
				<category><![CDATA[Codewars]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[C Language]]></category>
		<guid isPermaLink="false">https://onestringlab.com/?p=759</guid>

					<description><![CDATA[<p>Given an array of ones and zeroes, convert the equivalent binary value to an integer. Eg: [0, 0, 0, 1] is treated as 0001 which &#8230; </p>
<p>The post <a href="https://onestringlab.com/ones-and-zero/">Belajar Bahasa C &#8211; Ones and Zeros</a> appeared first on <a href="https://onestringlab.com">Onestring Lab</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Given an array of ones and zeroes, convert the equivalent binary value to an integer.</p>



<p>Eg: [0, 0, 0, 1] is treated as 0001 which is the binary representation of 1.</p>



<p><strong>Examples</strong>:</p>



<pre class="wp-block-code"><code class="">Testing: [0, 0, 0, 1] ==&gt; 1
Testing: [0, 0, 1, 0] ==&gt; 2
Testing: [0, 1, 0, 1] ==&gt; 5
Testing: [1, 0, 0, 1] ==&gt; 9
Testing: [0, 0, 1, 0] ==&gt; 2
Testing: [0, 1, 1, 0] ==&gt; 6
Testing: [1, 1, 1, 1] ==&gt; 15
Testing: [1, 0, 1, 1] ==&gt; 11</code></pre>



<p>The link problem is <a href="https://bit.ly/3gGHwpT" target="_blank" rel="noreferrer noopener">here</a>.</p>



<p><strong>Solution</strong>:</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp line-numbers">#include &lt;stddef.h&gt;

unsigned binary_array_to_numbers(const unsigned *bits, size_t count)
{
  unsigned numbers=0;
  
  for(size_t i = 0; i &lt; count; i++)
  {
    numbers += (bits[i] * pow(2,count-i-1));
  }
  return numbers;
} </code></pre>
<p>The post <a href="https://onestringlab.com/ones-and-zero/">Belajar Bahasa C &#8211; Ones and Zeros</a> appeared first on <a href="https://onestringlab.com">Onestring Lab</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
