<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4943281798273341903</id><updated>2012-02-16T13:49:45.404Z</updated><category term='pointers'/><category term='Astrophysicist'/><category term='fifteen'/><category term='Astro physics'/><category term='Hannan'/><category term='Hanan'/><category term='15'/><category term='C'/><category term='programming'/><category term='year old'/><category term='Hashim'/><category term='14'/><category term='fourteen'/><category term='Binth'/><category term='Ashim'/><category term='Kozhikode'/><title type='text'>ormmakal</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://pillasar.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4943281798273341903/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://pillasar.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Pillaisir</name><uri>http://www.blogger.com/profile/01567162178022976215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_1IBsqEiaRlY/SrNK0A5kUaI/AAAAAAAAAm8/raDgcwfE-O8/S220/me.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4943281798273341903.post-4101260755189443102</id><published>2009-12-19T11:01:00.009Z</published><updated>2009-12-19T16:27:06.281Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='C'/><category scheme='http://www.blogger.com/atom/ns#' term='pointers'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>C pointers - Part - I</title><content type='html'>&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-weight: bold;"&gt;C pointers – An introduction&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;b&gt;=====================&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;This is fairly basic stuff, University level if you want to call that. If you are a professional developer using C, then you wouldn’t find anything new here and you might be wasting your time. If you are new to C and is struggling to get in terms with pointers, as I have during my Uni days, you might find this helpful.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Okay so let’s get into the topic straightaway.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;What happens when you declare a variable, say of type char? This is how you would do it:&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;char&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;var&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;span style="font-size: small;"&gt;0&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;So you have declared a variable of type char, which is a single byte, named ‘var’ and you have initialized that to 0. When you build this code (obviously not just this declaration, with a main function and the necessary header files and all that), the compiler would allocate a memory location say at 0x1234, where the variable ‘var’ would reside.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;table align="left" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;0x1234&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;td bgcolor="white" height="30" style="-webkit-background-clip: initial; -webkit-background-origin: initial; background-attachment: initial; background-color: white; background-image: initial; background-position: initial initial; background-repeat: initial; border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 0.75pt; border-left-color: black; border-left-style: solid; border-left-width: 0.75pt; border-right-color: black; border-right-style: solid; border-right-width: 0.75pt; border-top-color: black; border-top-style: solid; border-top-width: 0.75pt; vertical-align: top;" width="102"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="left: 0pt; position: absolute; z-index: 1;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;0000 &amp;nbsp;0000&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;So if you are not going to modify the value of ‘var’ inside the code, this memory location would have the value 0. &amp;amp;var denotes the address where ‘var’ is residing and in this case the value of &amp;amp;var will be 0x1234. If later on in the code we change the value of ‘var’ say,&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;var &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;= &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;span style="font-size: small;"&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;then, the memory location 0x1234 will now have the value 10 instead of 0. Whenever you use the variable ‘var’ in your code, the compiler knows that it needs to pick the value sitting in the memory location 0x1234 (Well, only if the variable is still in scope, but lets imagine that we only have a main function in the code and no other sub functions).&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;table align="left" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&lt;span style="font-size: small;"&gt;0x1234&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;td bgcolor="white" height="30" style="-webkit-background-clip: initial; -webkit-background-origin: initial; background-attachment: initial; background-color: white; background-image: initial; background-position: initial initial; background-repeat: initial; border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 0.75pt; border-left-color: black; border-left-style: solid; border-left-width: 0.75pt; border-right-color: black; border-right-style: solid; border-right-width: 0.75pt; border-top-color: black; border-top-style: solid; border-top-width: 0.75pt; vertical-align: top;" width="102"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;0000 1010&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Now what would happen if ‘var’ was an int? i.e we have made the declaration of ‘var’ as follows:&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;int&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;var&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;= &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;span style="font-size: small;"&gt;256&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Size of int can vary from system to system. But let’s assume we are using a 16-bit (2 bytes) processor and the size of int is 2 bytes. Compiler will allocate a memory location for ‘var’, say at 0x2345. So what happens when you read the variable ‘var’ somewhere in your code? Would we just need to read the location 0x2345? By declaring as int, we have told the compiler that ‘var’ is now 2 bytes. So the compiler knows that it would need to read both 0x2345 and 0x2346 (it is assumed that the system is big endian in all the examples explained here).&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;table align="left" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;MSB&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;0x2345&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;td bgcolor="white" height="30" style="-webkit-background-clip: initial; -webkit-background-origin: initial; background-attachment: initial; background-color: white; background-image: initial; background-repeat: initial; border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 0.75pt; border-left-color: black; border-left-style: solid; border-left-width: 0.75pt; border-right-color: black; border-right-style: solid; border-right-width: 0.75pt; border-top-color: black; border-top-style: solid; border-top-width: 0.75pt; vertical-align: top;" width="102"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;0000 0001&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;table align="left" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&lt;span style="font-family: 'Times New Roman';"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;LSB&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;0x2346&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;td bgcolor="white" height="30" style="-webkit-background-clip: initial; -webkit-background-origin: initial; background-attachment: initial; background-color: white; background-image: initial; background-repeat: initial; border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 0.75pt; border-left-color: black; border-left-style: solid; border-left-width: 0.75pt; border-right-color: black; border-right-style: solid; border-right-width: 0.75pt; border-top-color: black; border-top-style: solid; border-top-width: 0.75pt; vertical-align: top;" width="102"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;0000 0000&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="MsoNormal"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Now let’s start with pointers.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;This is how a pointer is declared:&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;char *&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;ptr&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; = &amp;nbsp; null;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Here, we are declaring an identifier ptr as a pointer of type char.&amp;nbsp; By doing so, we are telling the compiler that the identifier ptr contains not just a variable&amp;nbsp;–&amp;nbsp;it has a specialty – it is an address! Address of a variable of type char. On building the code, the compiler allocates a memory location; say 0x3456, for ptr to live which currently has a value ‘null’.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Suppose you have the following bit of code in your program:&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;char *&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;ptr&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; = &amp;nbsp; null;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;char&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;var&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; = &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;span style="font-size: small;"&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;ptr&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= &amp;nbsp; &amp;amp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;var&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;On building the code, let’s assume the compiler allocated the address 0x2345 for var and 0x3456 for ptr. Hence initially, 0x2345 contains the value 10 and 0x3456 contains null. On executing the third line, ptr will change from null to address of var which is 0x2345. Hence, address of ptr (&amp;amp;ptr) is 0x3456 and ptr contains the value 0x2345 which is an address. And what more is, *ptr will give you the value residing in the address 0x2345.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;To summarize,&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Declaring char * ptr tells the compiler that ptr contains an address.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;When you use ptr, you are using the address 0x3456.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;When you use *ptr, you are using the value inside the address 0x3456.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;The symbol ‘*’ is used to ‘dereference’ the pointer. i.e for finding out what value the pointer holds.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;In this case we had a char pointer, which means the pointer points to a variable of type char. Hence when you dereference it, the compiler will know that it has to read a single byte in the address pointed by the pointer. What would happen if the pointer was of type int? Consider the following piece of code:&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;*&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;ptr&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; = &amp;nbsp; null;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;b&gt;Pointer arithmetic:&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;b&gt;==============&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;This is quite an important concept and quite a useful one when you start writing some serious code in C. Consider the char * ptr case again:&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;char *&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;ptr&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; = &amp;nbsp; null;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;char&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;var&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; = &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;span style="font-size: small;"&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;int&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;ptrVal&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; = &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;span style="font-size: small;"&gt;0&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;ptr&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= &amp;nbsp; &amp;amp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;var&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;ptrVal&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;ptr&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;+&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;span style="font-size: small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;The value of ptr was 0x2345 since we assigned the address of var to it. So what would be the value of ptrVal after the execution of the last statement? The answer is pretty straightforward in this case; ptrVal will be 0x2346 – address of the next memory location.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Now, consider a slightly different scenario:&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;int *&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;ptr&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;= &amp;nbsp; null;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;char&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;var&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; = &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;span style="font-size: small;"&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;int&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;ptrVal&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;= &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;span style="font-size: small;"&gt;0&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;ptr&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;var&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="font-size: small;"&gt;ptrVal&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; = &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;ptr&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;+&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;span style="font-size: small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Here the pointer is of type int. Again, what would be the value of ptrVal after the execution of last statement? ptr is 0x2345, so ptrVal should be 2345 + 1 which is 0x2346 just as our first case, you might think. Well, it is not. This is pointer arithmetic, so when we are adding 1 (or any other digit) to a pointer, the compiler looks for the address of the next int in the memory location. Since int is two bytes long in our examples, ptrVal will be 0x2347.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Similarly ptrVal + 2 will be 0x2349, ptrVal + 2 will be 0x234A and so on. This was the same in the previous example as well, but since the pointer was of type char, the size of the variable it points to is one byte. Hence ptr + 1 would only be the next consecutive address after ptr, which made it look similar to normal arithmetic.&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Will post the next section 'Using pointers' soon!&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4943281798273341903-4101260755189443102?l=pillasar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pillasar.blogspot.com/feeds/4101260755189443102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pillasar.blogspot.com/2009/12/c-pointers-part-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4943281798273341903/posts/default/4101260755189443102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4943281798273341903/posts/default/4101260755189443102'/><link rel='alternate' type='text/html' href='http://pillasar.blogspot.com/2009/12/c-pointers-part-i.html' title='C pointers - Part - I'/><author><name>Pillaisir</name><uri>http://www.blogger.com/profile/01567162178022976215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_1IBsqEiaRlY/SrNK0A5kUaI/AAAAAAAAAm8/raDgcwfE-O8/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4943281798273341903.post-5083530918967921055</id><published>2009-09-15T09:52:00.003+01:00</published><updated>2009-09-17T09:19:22.518+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hanan'/><category scheme='http://www.blogger.com/atom/ns#' term='year old'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashim'/><category scheme='http://www.blogger.com/atom/ns#' term='fifteen'/><category scheme='http://www.blogger.com/atom/ns#' term='Astrophysicist'/><category scheme='http://www.blogger.com/atom/ns#' term='Binth'/><category scheme='http://www.blogger.com/atom/ns#' term='15'/><category scheme='http://www.blogger.com/atom/ns#' term='fourteen'/><category scheme='http://www.blogger.com/atom/ns#' term='Hannan'/><category scheme='http://www.blogger.com/atom/ns#' term='Hashim'/><category scheme='http://www.blogger.com/atom/ns#' term='Astro physics'/><category scheme='http://www.blogger.com/atom/ns#' term='14'/><category scheme='http://www.blogger.com/atom/ns#' term='Kozhikode'/><title type='text'>Hannan Binth Hashim - Hoax or true story?</title><content type='html'>&lt;div align="justify"&gt;This is the latest hot story in the internet - Hannan Binth Hashim, the wondergirl! The whole episode is really so amusing that I just can't believe it and I am going to question the credibility of this story. So if this is indeed true, I owe a big apology to her. It could be also possible that it is partly true and it was exaggerated by some of the bloggers and news papers.&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;I read it first in the Malayalam daily, 'Mathrubhumi', which is one of the most respected news papers, known for sticking to journalism ethics and all those funky words which one can use when describing a reputed news paper. So when you read any news from such a source you don't have to doubt the credibility of the news; you read it and you take it all, is not? On the first read, I was all praise for the young talent. Questioning Einstein!!?? Doubt the Bing bang theory!! All at the age of 15!!!!! And here is me. I remembered that the video lectures about Special Relativiy theory from a Stanford University professor I downloaded from youtube is still sitting in my laptop. I have not even watched the first 5 minutes of that entire lecture series. Right click -&gt; Properties : 'date created' and 'last accessed' are the same ;-) some six months back! I am the one who couldn't go past the second chapter of 'Brief history of time'. And this 15 year old girl.. My my!! And she is a fellow Indian!! I got goose bumps!! Motivated, I got back to my work, testing my code. Bloody hell!! The processor is still not willing to yield. I spent an hour on the bloody board still with no result. I am not good.. I felt like giving up. Motivation! that is what I need. &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;Hmm&lt;/span&gt;&lt;/span&gt;, I know an easy source of motivation now, don't I? I opened '&lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;Mathrubhumi&lt;/span&gt;&lt;/span&gt;' website and started reading the article about &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;Hannan&lt;/span&gt;&lt;/span&gt; again.&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;What?? Hold on!! She designed a rocket? And NASA launched it?? Was it not there when I read it last time? Or did I not see it because of the excite&lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;ment&lt;/span&gt;&lt;/span&gt;? Now that is unreal! She was supposed to be researching in theoretical physics and &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;astro&lt;/span&gt;&lt;/span&gt;-physics. What has it got to do with designing space crafts? I read the article again. She graduated from NASA! Well, she is holding the graduate certificate as well. I zoomed in the pic, it says 'Space school graduate'. Googled it; couldn't find anything. The article quotes her mother saying that it took 13 days of exams and experiments and presenting papers at &lt;span id="SPELLING_ERROR_5" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_5" class="blsp-spelling-error"&gt;NASA's&lt;/span&gt;&lt;/span&gt; space school in Houston to achieve that. Okay, so &lt;span id="SPELLING_ERROR_6" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_6" class="blsp-spelling-error"&gt;NASA's&lt;/span&gt;&lt;/span&gt; space school in Houston then, googled again. Wow, NASA do have a space school in Houston. I opened the first link:&lt;/div&gt;&lt;div align="justify"&gt;&lt;a href="http://www.spacecenter.org/"&gt;http://www.spacecenter.org/&lt;/a&gt;&lt;/div&gt;&lt;div align="justify"&gt;The space centre is the official visitor's centre of &lt;span id="SPELLING_ERROR_7" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_7" class="blsp-spelling-error"&gt;NASA's&lt;/span&gt;&lt;/span&gt; Johnson Space Centre in Houston: &lt;/div&gt;&lt;div align="justify"&gt;&lt;a href="http://ares.jsc.nasa.gov/"&gt;http://ares.jsc.nasa.gov/&lt;/a&gt;&lt;/div&gt;&lt;div align="justify"&gt;So do they have a school where they award graduate degrees? Aha! they do indeed! I read on..&lt;/div&gt;&lt;div align="justify"&gt;&lt;a href="http://www.spacecenter.org/spaceschool.html"&gt;http://www.spacecenter.org/spaceschool.html&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;Well well! it doesn't look like a real graduate degree! The space centre is really like an exhibition centre. School students can join for a five day course for a fee, where in they do different team activities - designing rockets etc (nothing too technical as depicted in the numerous &lt;span id="SPELLING_ERROR_8" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_8" class="blsp-spelling-error"&gt;Hannan&lt;/span&gt;&lt;/span&gt; related blogs and articles). And at the end of the school which is after the &lt;span id="SPELLING_ERROR_9" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_9" class="blsp-spelling-error"&gt;pre&lt;/span&gt;&lt;/span&gt;-mentioned five days, they award a certificate of graduation. It is this certificate which the girl (&lt;span id="SPELLING_ERROR_10" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_10" class="blsp-spelling-error"&gt;Hannan&lt;/span&gt;&lt;/span&gt; or who ever really that is) in the picture is holding! I am not certainly getting much motivation here!&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;I googled for all &lt;span id="SPELLING_ERROR_11" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_11" class="blsp-spelling-error"&gt;Hannan&lt;/span&gt;&lt;/span&gt; related articles. All those come up were from Indian &lt;span id="SPELLING_ERROR_12" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_12" class="blsp-spelling-error"&gt;bloggers&lt;/span&gt;&lt;/span&gt; or some Indian news sites. Some says she has papers presented in MIT, University of Boston etc. &lt;span id="SPELLING_ERROR_13" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_13" class="blsp-spelling-error"&gt;Mathrubhumi&lt;/span&gt;&lt;/span&gt; says she is going to join MIT as a student. So from tenth standard to a graduation in MIT then? I searched the websites of all these universities and NASA where she supposedly has presented papers on Astrophysics. Couldn't find anything about her. Searched in the Siemens &lt;span id="SPELLING_ERROR_14" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_14" class="blsp-spelling-error"&gt;Westinhouse&lt;/span&gt;&lt;/span&gt; Science and Technology Competition site where she is supposed to compete with other students. Couldn't find her details at all. Why am I not surprised now? One last try - searched for Dr. &lt;span id="SPELLING_ERROR_15" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_15" class="blsp-spelling-error"&gt;Soumya&lt;/span&gt;&lt;/span&gt; &lt;span id="SPELLING_ERROR_16" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_16" class="blsp-spelling-error"&gt;Vasudevan&lt;/span&gt;&lt;/span&gt; who is a Hind Rattan winner - &lt;span id="SPELLING_ERROR_17" class="blsp-spelling-error"&gt;Hannan's&lt;/span&gt; mentor as described in the article. &lt;span id="SPELLING_ERROR_17" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_18" class="blsp-spelling-error"&gt;Wikipedia&lt;/span&gt;&lt;/span&gt; doesn't list that name among the Hind rattan winners, but that is not really an exhaustive list. So I searched again. Initially when I posted this article the first time, I didn't find any details about her. After some googling I got the details of Dr.Sowmya Viswanathan (note the difference in name), who is a Hind Rattan award winner, but she is a medical &lt;span id="SPELLING_ERROR_19" class="blsp-spelling-corrected"&gt;practitioner&lt;/span&gt;. I also noticed that the 'American Journal of Theoretical Physics' where &lt;span id="SPELLING_ERROR_18" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_20" class="blsp-spelling-error"&gt;Hannan's&lt;/span&gt;&lt;/span&gt; papers are going to get published, never existed.&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span id="SPELLING_ERROR_19" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_21" class="blsp-spelling-error"&gt;Hmmm&lt;/span&gt;&lt;/span&gt;.. I think I will call it a day and test my code tomorrow. &lt;/div&gt;&lt;div align="justify"&gt;By evening &lt;span id="SPELLING_ERROR_20" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_22" class="blsp-spelling-error"&gt;Mathrubhumi&lt;/span&gt;&lt;/span&gt; has published another news about educational minister calling to congratulate &lt;span id="SPELLING_ERROR_21" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_23" class="blsp-spelling-error"&gt;Hannan&lt;/span&gt;&lt;/span&gt;! What?? Well, I don't know. I am all the more bemused! What is it? A true story or a hoax?&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4943281798273341903-5083530918967921055?l=pillasar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pillasar.blogspot.com/feeds/5083530918967921055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pillasar.blogspot.com/2009/09/hannan-binth-hashim-hoax-or-true-story.html#comment-form' title='50 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4943281798273341903/posts/default/5083530918967921055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4943281798273341903/posts/default/5083530918967921055'/><link rel='alternate' type='text/html' href='http://pillasar.blogspot.com/2009/09/hannan-binth-hashim-hoax-or-true-story.html' title='Hannan Binth Hashim - Hoax or true story?'/><author><name>Pillaisir</name><uri>http://www.blogger.com/profile/01567162178022976215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_1IBsqEiaRlY/SrNK0A5kUaI/AAAAAAAAAm8/raDgcwfE-O8/S220/me.jpg'/></author><thr:total>50</thr:total></entry></feed>
