<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-2%3Amspe044</id>
	<title>SE250:lab-2:mspe044 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-2%3Amspe044"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-2:mspe044&amp;action=history"/>
	<updated>2026-04-28T19:42:14Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.kram.nz/index.php?title=SE250:lab-2:mspe044&amp;diff=4998&amp;oldid=prev</id>
		<title>Mark: 5 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-2:mspe044&amp;diff=4998&amp;oldid=prev"/>
		<updated>2008-11-03T05:19:01Z</updated>

		<summary type="html">&lt;p&gt;5 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;I had a few initial problems getting emacs to do what I wanted... however eventually got it under control&lt;br /&gt;
with the help from someone else in the lab.&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
1) I found the pointer *ip to be 4 bites in size&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
2) The difference between x and y to be 1 bite (4 bits) &lt;br /&gt;
0x22ccbc + 4 = 0x22ccc0&lt;br /&gt;
&lt;br /&gt;
When using (long)&amp;amp;x - (long)&amp;amp;y as apposed to (long)(&amp;amp;x - &amp;amp;y)) the difference was 8 bits, im not sure&lt;br /&gt;
why this is, in truth it makes no sense to me but im sure we will find out in the lecture&lt;br /&gt;
 &lt;br /&gt;
With arr[0] the difference between x and y was 7&lt;br /&gt;
With arr[1] the difference between x and y was 2&lt;br /&gt;
With arr[2] the difference between x and y was 7&lt;br /&gt;
With arr[3] the difference between x and y was 2&lt;br /&gt;
With arr[4] the difference between x and y was 2&lt;br /&gt;
With arr[5] the difference between x and y was 7&lt;br /&gt;
With arr[6] the difference between x and y was 7&lt;br /&gt;
With arr[7] the difference between x and y was 7&lt;br /&gt;
With arr[8] the difference between x and y was 3&lt;br /&gt;
With arr[9] the difference between x and y was 7&lt;br /&gt;
 &lt;br /&gt;
In conclusion... memory locations are both dependant on what is being stored and its size (no brainer) and how&lt;br /&gt;
insane the computer is feeling at the time. This computer is clearly one bear short of a 6 pack...&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
4) As I pridicted this caused the array to have no effect on X and Y (most proberbly due to the fact that they&lt;br /&gt;
were declared before the array so it did not push them apart... I still maintain the comp is mad though...?&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
5) I &amp;#039;considered&amp;#039; the code:&lt;br /&gt;
&lt;br /&gt;
 int *p1, *p2;&lt;br /&gt;
 { int q; p1 = &amp;amp;q; }&lt;br /&gt;
 { int r; p2 = &amp;amp;r; }&lt;br /&gt;
&lt;br /&gt;
there was a one bite difference in the memory locations of q and r, I found this using the code:&lt;br /&gt;
&lt;br /&gt;
 printf(&amp;quot;q = %d, r = %d, diff = %ld\n&amp;quot;, &amp;amp;p1, &amp;amp;p2, (long) (&amp;amp;p1 - &amp;amp;p2));&lt;br /&gt;
&lt;br /&gt;
placed after the initial 3 lines given, however as in part one I found a pointer to be 4 bites in size, this&lt;br /&gt;
can&amp;#039;t be true (to my understanding) as there would have to be at least a 4 bite gap (as the first pointer is&lt;br /&gt;
4 bites long... something interesting to look into however&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
6) I ran the function code and recieved this as the result:&lt;br /&gt;
&lt;br /&gt;
sp = 0x22cc90 (456)&lt;br /&gt;
sp = 0x22cc90 (efg)&lt;br /&gt;
sp = 0x402000 (tuvwxyz)&lt;br /&gt;
sp = 0xda01a0 (hijklmn)&lt;br /&gt;
&lt;br /&gt;
What I can gather from this is that the second function wiped over the memory of the first function, as it is&lt;br /&gt;
in the same memory location... the 3rd and 4th functions however created new memory locations so preserved the&lt;br /&gt;
origional data.&lt;br /&gt;
&lt;br /&gt;
As to interperating the output, for some reason (I have no idea what) the first two functions wiped all but 3&lt;br /&gt;
characters of the data... the last two (which also preserved memory) kept ALL of there data when printed to&lt;br /&gt;
the screen... I doubt verry much that this is a coinsidance but I dont know what the link is.&lt;br /&gt;
&lt;br /&gt;
As a point of interest, adding the seamingly random code: strcpy( sp, &amp;quot;XXXXXXX&amp;quot; );&lt;br /&gt;
caused this outcome...					     printf( &amp;quot;sp X&amp;#039;d = %p(%s)\n&amp;quot;, sp, sp );&lt;br /&gt;
&lt;br /&gt;
sp = 0x22cc90(456)&lt;br /&gt;
sp X&amp;#039;d = 0x22cc90(-0@)&lt;br /&gt;
sp = 0x22cc90(efg)&lt;br /&gt;
sp X&amp;#039;d = 0x22cc90(-0@)&lt;br /&gt;
sp = 0x402000(tuvwxyz)&lt;br /&gt;
sp X&amp;#039;d = 0x402000(XXXXXXX)&lt;br /&gt;
sp = 0xda01a0 (hijklmn)&lt;br /&gt;
sp X&amp;#039;d = 0xda01a0(XXXXXXX)&lt;br /&gt;
&lt;br /&gt;
The added code follows a similer pattern to the origional 4 lines, the first two functions using the same memory&lt;br /&gt;
location, the 2nd two functions using new memory locations, ironicaly the actaul imformation heled (7*X) was not&lt;br /&gt;
preserved even to the print statement in the first two (just as it wipes over all memory already in that location&lt;br /&gt;
it seamingly wiped over memory used AFTER the function call... I dont know how that is (im assuming I have miss&lt;br /&gt;
interperated this somehow) but it dosnt seem possable...&lt;br /&gt;
&lt;br /&gt;
The result from the added code int he bottom two functions however makes ALOT more sense to me, just doing what I&lt;br /&gt;
expected the code to do.&lt;br /&gt;
&lt;br /&gt;
As a footnote, what kind of imformation is -0@ anyhow, how the heck that got into sp I will never know?!?!?&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
After 2 hours working at this Lab im gona call it quits or be late for my next Lecture (will pick it up at some&lt;br /&gt;
later point)&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>