<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://programmingexamples.net/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=CPP%2F2DArray</id>
		<title>CPP/2DArray - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=CPP%2F2DArray"/>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=CPP/2DArray&amp;action=history"/>
		<updated>2026-06-15T11:06:08Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.5</generator>

	<entry>
		<id>http://programmingexamples.net/w/index.php?title=CPP/2DArray&amp;diff=22&amp;oldid=prev</id>
		<title>Daviddoria at 11:33, 23 June 2010</title>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=CPP/2DArray&amp;diff=22&amp;oldid=prev"/>
				<updated>2010-06-23T11:33:02Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 11:33, 23 June 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;==2DArray.cpp==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#include &amp;lt;iostream&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#include &amp;lt;iostream&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Daviddoria</name></author>	</entry>

	<entry>
		<id>http://programmingexamples.net/w/index.php?title=CPP/2DArray&amp;diff=19&amp;oldid=prev</id>
		<title>Daviddoria: Created page with '&lt;source lang=&quot;cpp&quot;&gt; #include &lt;iostream&gt;  using namespace std;  void FixedLength(); void VariableLength();  void Fill(void* buffer, unsigned int Width, unsigned int Height); void …'</title>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=CPP/2DArray&amp;diff=19&amp;oldid=prev"/>
				<updated>2010-06-23T11:22:46Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt; #include &amp;lt;iostream&amp;gt;  using namespace std;  void FixedLength(); void VariableLength();  void Fill(void* buffer, unsigned int Width, unsigned int Height); void …&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
void FixedLength();&lt;br /&gt;
void VariableLength();&lt;br /&gt;
&lt;br /&gt;
void Fill(void* buffer, unsigned int Width, unsigned int Height);&lt;br /&gt;
void Read(void* buffer, unsigned int Width, unsigned int Height);&lt;br /&gt;
&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
  FixedLength();&lt;br /&gt;
  VariableLength();&lt;br /&gt;
  &lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Fill(void* buffer, unsigned int Width, unsigned int Height)&lt;br /&gt;
{&lt;br /&gt;
  char* buff = static_cast&amp;lt;char*&amp;gt; (buffer);&lt;br /&gt;
  for(unsigned int i = 0; i &amp;lt; Width; ++i)&lt;br /&gt;
  {&lt;br /&gt;
    for(unsigned int j = 0; j &amp;lt; Height; ++j)&lt;br /&gt;
    {&lt;br /&gt;
	    buff[Width*i + Height*j + 0] = 0;&lt;br /&gt;
	    buff[Width*i + Height*j + 1] = 1;&lt;br /&gt;
	    buff[Width*i + Height*j + 2] = 2;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Read(void* buffer, unsigned int Width, unsigned int Height)&lt;br /&gt;
{&lt;br /&gt;
  unsigned char r,g,b;&lt;br /&gt;
  &lt;br /&gt;
  char * buff = static_cast&amp;lt;char*&amp;gt; (buffer);&lt;br /&gt;
  for(unsigned int i = 0; i &amp;lt; Width; ++i)&lt;br /&gt;
  {&lt;br /&gt;
    for(unsigned int j = 0; j &amp;lt; Height; ++j)&lt;br /&gt;
    {&lt;br /&gt;
      r = buff[i*Width + j*Height + 0];&lt;br /&gt;
      g = buff[i*Width + j*Height + 1];&lt;br /&gt;
      b = buff[i*Width + j*Height + 2];&lt;br /&gt;
      cout &amp;lt;&amp;lt; static_cast&amp;lt;int&amp;gt;(r) &amp;lt;&amp;lt; &amp;quot; &amp;quot; &amp;lt;&amp;lt; static_cast&amp;lt;int&amp;gt;(g) &amp;lt;&amp;lt; &amp;quot; &amp;quot; &amp;lt;&amp;lt; static_cast&amp;lt;int&amp;gt;(b) &amp;lt;&amp;lt; endl;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  cout &amp;lt;&amp;lt; endl; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void FixedLength()&lt;br /&gt;
{&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Fixed Length:&amp;quot; &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; &amp;quot;-------------&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  unsigned int Width = 4;&lt;br /&gt;
  unsigned int Height = 4;&lt;br /&gt;
  &lt;br /&gt;
  unsigned char buffer[4][4][3];&lt;br /&gt;
  &lt;br /&gt;
  Fill(buffer, Width, Height);&lt;br /&gt;
  Read(buffer, Width, Height);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void VariableLength()&lt;br /&gt;
{&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Variable Length:&amp;quot; &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; &amp;quot;-------------&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  unsigned int Width = 4;&lt;br /&gt;
  unsigned int Height = 4;&lt;br /&gt;
  unsigned int d1 = Width, d2 = Height;&lt;br /&gt;
  //Want to do this: unsigned char bufImage[Width][Height][3];&lt;br /&gt;
&lt;br /&gt;
  unsigned char* buffer = new unsigned char[Width*Height*3];&lt;br /&gt;
  &lt;br /&gt;
  for(unsigned int i = 0; i &amp;lt; Width; ++i)&lt;br /&gt;
  {&lt;br /&gt;
    for(unsigned int j = 0; j &amp;lt; Height; ++j)&lt;br /&gt;
    {&lt;br /&gt;
      buffer[i*d1+j*d2+0] = 0;&lt;br /&gt;
      buffer[i*d1+j*d2+1] = 0;&lt;br /&gt;
      buffer[i*d1+j*d2+2] = 0;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  Fill(buffer, Width, Height);&lt;br /&gt;
  Read(buffer, Width, Height);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daviddoria</name></author>	</entry>

	</feed>