<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 01_Pointers References</title><link>https://sourceforge.net/p/cppforgreatness/wiki/01_Pointers%2520References/</link><description>Recent changes to 01_Pointers References</description><atom:link href="https://sourceforge.net/p/cppforgreatness/wiki/01_Pointers%20References/feed" rel="self"/><language>en</language><lastBuildDate>Mon, 01 Dec 2014 17:31:14 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/cppforgreatness/wiki/01_Pointers%20References/feed" rel="self" type="application/rss+xml"/><item><title>01_Pointers References modified by Nitin Deshpande</title><link>https://sourceforge.net/p/cppforgreatness/wiki/01_Pointers%2520References/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nitin Deshpande</dc:creator><pubDate>Mon, 01 Dec 2014 17:31:14 -0000</pubDate><guid>https://sourceforge.netd7af0491b37e76eb767e9dea5b248654929aaf6a</guid></item><item><title>01_CPP modified by Nitin Deshpande</title><link>https://sourceforge.net/p/cppforgreatness/wiki/01_CPP/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v6
+++ v7
@@ -75,7 +75,43 @@
 - C: &amp;lt;TYPE&amp;gt;&amp;amp; functionname(param1,param2,...,paramN) returns an object of type &amp;lt;TYPE&amp;gt;
 }

+C[3]:
+{
+C: Stream Class Shift Operators "&amp;lt;&amp;lt;" and "&amp;gt;&amp;gt;"
+C: &amp;lt;&amp;lt; returns reference to cout object.
+C: &amp;gt;&amp;gt; returns reference to cin object.
+}
+
+C[4]:
+{
+C: Assignment Operator =
+The assignment operator '=' returns a reference to the lvalue (operand on the left of the '='). The lvalue must therefore be an object.
+}
+
+C[5]:
+{
+_**Pointers**_
+C: A Pointer is an expression that contains the data and address of another object. The &amp;amp; operator provides the address to an int object, and pointer to a declared object.
+C: A pointer points to an address of an object.
+C: Pointer variables can store address of another object. Init details int* ptr or int *ptr ( read as ptr is a pointer to type int, * to be read as pointer to).
+C: Declare a pointer of type T, T* ptrName;, next, point the pointer at a memory address (of a variable that belongs to the same base class as ptrName, i.e T.) of another variable.
+   T varName; ptrName = &amp;amp;varName;
+
+_**Pointers vs References**_
+C: A pointer is not merely an alias. However, both references and pointers refer to an object in memory.
+C: A pointer has a separate identity of its own. It has its address. T* ptrName; &amp;amp;ptrName would provide the address of the pointer ptrName.
+C: A reference on the other hand cannot be manipulated. In contrast to a reference, a pointer can be manipulated by pointing it to a new address in memory.
+
+_**The Dereferencing operator * or Indirection operator**_
+C: The * operator facilitates by providing the “value pointed by” a pointer ptrname.
+}
+
+C[6]:
+{
+_**Pointers as function parameters**_
+C: A way of passing the address of the object as a function parameter.
+C: This can be acheived by declaring a pointer variable.
+}
+
 Nitin Deshpande
 &amp;lt;deshpand@in.tum.de&amp;gt;
-
-
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nitin Deshpande</dc:creator><pubDate>Tue, 25 Nov 2014 02:19:13 -0000</pubDate><guid>https://sourceforge.net3c031c296b6c6e71751f18f2bb72af0f5cd8ecd6</guid></item><item><title>01_CPP modified by Nitin Deshpande</title><link>https://sourceforge.net/p/cppforgreatness/wiki/01_CPP/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v5
+++ v6
@@ -64,7 +64,7 @@
 cout&amp;lt;&amp;lt; "name contains: "&amp;lt;&amp;lt; name &amp;lt;&amp;lt; endl;
 =======================================================================================================

-Functions that return reference.
+_**Functions that return reference.**_
 C[2]:
 {
 - C: &amp;lt;TYPE&amp;gt;&amp;amp; functionname(param1,param2,...,paramN)
@@ -79,4 +79,3 @@
 &amp;lt;deshpand@in.tum.de&amp;gt;

-
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nitin Deshpande</dc:creator><pubDate>Tue, 25 Nov 2014 00:28:53 -0000</pubDate><guid>https://sourceforge.net0eae46535bc5dafeca9d8fc0303083e6e0973682</guid></item><item><title>01_CPP modified by Nitin Deshpande</title><link>https://sourceforge.net/p/cppforgreatness/wiki/01_CPP/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nitin Deshpande</dc:creator><pubDate>Mon, 24 Nov 2014 20:31:58 -0000</pubDate><guid>https://sourceforge.netd587f71e891d4eb46b55b95ce2415aff42622ea6</guid></item><item><title>01_CPP modified by Nitin Deshpande</title><link>https://sourceforge.net/p/cppforgreatness/wiki/01_CPP/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -39,10 +39,44 @@
 - C: The reference &amp;amp;refT is a different way to express T. Operations such as refT++, refT--, refT*=4 affect the value of T.
 - C: The reference &amp;amp; occurs only in the declaration/inits.
 }
+=======================================================================================================
+&amp;lt;http: www.cplusplus.com="" reference="" string="" string="" getline=""/&amp;gt;
+std::getline (string)
+(1)    
+istream&amp;amp; getline (istream&amp;amp;  is, string&amp;amp; str, char delim);
+istream&amp;amp; getline (istream&amp;amp;&amp;amp; is, string&amp;amp; str, char delim);
+(2)    
+istream&amp;amp; getline (istream&amp;amp;  is, string&amp;amp; str);
+istream&amp;amp; getline (istream&amp;amp;&amp;amp; is, string&amp;amp; str);
+=======================================================================================================
+Parameters
+is
+istream object from which characters are extracted.
+str
+string object where the extracted line is stored.
+The contents in the string before the call (if any) are discarded and replaced by the extracted line.
+=======================================================================================================
+Return Value
+The same as parameter is.
+=======================================================================================================
+cout&amp;lt;&amp;lt; "Enter the name, once done, hit Enter..." &amp;lt;&amp;lt; endl;
+getline(cin,name); //http://www.cplusplus.com/reference/string/string/getline/
+cout&amp;lt;&amp;lt; "name contains: "&amp;lt;&amp;lt; name &amp;lt;&amp;lt; endl;
+=======================================================================================================
+
+Functions that return reference.
+C[2]:
+{
+- C: &amp;lt;TYPE&amp;gt;&amp;amp; functionname(param1,param2,...,paramN)
+eg: float&amp;amp; floorval(float floatVal) returns the floor value of a float value number. For instance, floorval(4.98) would return 4.0F.
+- C: Some operation performed on the function would effect the return value and not the parameters. ++floorval(4.98) would return 5.0F.
+- C: Returning ref from a function vs normal functions - In the latter case, you cannot perform any operations on the return values of the function call, but in the former case it
+is possible. For eg: float floorval(float floatVal), this operation during function call ++floorval(1.0,4.0) is not possible.
+- C: &amp;lt;TYPE&amp;gt;&amp;amp; functionname(param1,param2,...,paramN) returns an object of type &amp;lt;TYPE&amp;gt;
+}

 Nitin Deshpande
 &amp;lt;deshpand@in.tum.de&amp;gt;

-
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nitin Deshpande</dc:creator><pubDate>Mon, 24 Nov 2014 20:31:28 -0000</pubDate><guid>https://sourceforge.netab64ef268573972b1d2121d7b3d28c50298d2427</guid></item><item><title>01_CPP modified by Nitin Deshpande</title><link>https://sourceforge.net/p/cppforgreatness/wiki/01_CPP/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -14,7 +14,7 @@
 * Return values as references from functions?
 * Pass by ref vs pass by value...

-**MAIN:**
+MAIN:
 A reference is a mere alias for an existing object. Meaning, it would store the address of a variable.

@@ -29,6 +29,9 @@
 int h=10;  
 float &amp;amp;p=h;

+* C: Underneath it all, a reference refT to object T is typically the machine address of the object T.
+
+* C: In compiler writer lingo, a reference is an "lvalue" (something that can appear on the left hand side of an assignment operator).

 C[1]:
 {
@@ -43,4 +46,3 @@

-
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nitin Deshpande</dc:creator><pubDate>Mon, 24 Nov 2014 12:23:04 -0000</pubDate><guid>https://sourceforge.net15693e9bcc382ee5633581c2599b2962ca8eea5a</guid></item><item><title>01_CPP modified by Nitin Deshpande</title><link>https://sourceforge.net/p/cppforgreatness/wiki/01_CPP/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -37,7 +37,6 @@
 - C: The reference &amp;amp; occurs only in the declaration/inits.
 }

-Author
 Nitin Deshpande
 &amp;lt;deshpand@in.tum.de&amp;gt;

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nitin Deshpande</dc:creator><pubDate>Mon, 24 Nov 2014 11:00:43 -0000</pubDate><guid>https://sourceforge.net5b6c64eca8970fa2bc261bd1693f9c37ae824147</guid></item><item><title>01_CPP modified by Nitin Deshpande</title><link>https://sourceforge.net/p/cppforgreatness/wiki/01_CPP/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;01 Pointers and references&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This readme would contain notes and practical aspects from&lt;br /&gt;
&lt;span&gt;[CGCPP]&lt;/span&gt; A_Complete_Guide_to_Programming_in_C++_Ulla_Kirch_Prinz_Peter_Prinz&lt;br /&gt;
&lt;span&gt;[ISCPP]&lt;/span&gt; Industrial_Strength_C++_Henricson_Nyquist&lt;br /&gt;
C&lt;span&gt;[&amp;lt;number&amp;gt;]&lt;/span&gt;: Important concepts&lt;br /&gt;
C: Concept&lt;br /&gt;
MAIN: Main objective / Introductory notes.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;[CGCPP]&lt;/span&gt;: References and pointers&lt;br /&gt;
Objectives of the chapter:&lt;br /&gt;
MAIN: What is a pointer and what is a reference?&lt;br /&gt;
&lt;em&gt; How to pass references as parameters to functions?&lt;br /&gt;
&lt;/em&gt; Return values as references from functions?&lt;br /&gt;
* Pass by ref vs pass by value...&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MAIN:&lt;/strong&gt;&lt;br /&gt;
A reference is a mere alias for an existing object. Meaning, it would store the address of a variable.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;C: A reference value has to be initialised in the code. If not, trash values can occur, or the compiler will generate&lt;br /&gt;
an error message. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;C: Once initialised, it is unchangeable. Meaning, in the subsequent lines of codes, you cannot use the reference to address a different variable.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;C: &amp;amp; is used to define a reference to a datatype. for eg: float &amp;amp;p; is read as reference to type float.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;C: Reference provided to an object should be of the same type. Meaning, the following lines of code will not compile: &lt;br /&gt;
int h=10; &lt;br /&gt;
float &amp;amp;p=h;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;C&lt;span&gt;[1]&lt;/span&gt;:&lt;br /&gt;
{&lt;br /&gt;
- C: Do not confuse with the address operator "&amp;amp;".... this merely returns the address of the object.&lt;br /&gt;
- C: The reference &amp;amp;refT is a different way to express T. Operations such as refT++, refT--, refT*=4 affect the value of T.&lt;br /&gt;
- C: The reference &amp;amp; occurs only in the declaration/inits.&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;Author&lt;br /&gt;
Nitin Deshpande&lt;br /&gt;
&lt;a href="mailto:deshpand@in.tum.de"&gt;deshpand@in.tum.de&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nitin Deshpande</dc:creator><pubDate>Mon, 24 Nov 2014 10:56:00 -0000</pubDate><guid>https://sourceforge.netcc6ca46bfc4d93453b2c485d0afa580b6e6bebf2</guid></item></channel></rss>