I am learning C ++ and my textbook (C ++ primer) offers this example:
< Pre> int strange [] = {1,3,5,7,9}; Inf also [] = {0,2,4,6,8}; // gives an indicator for an array of five elements auto arrPtr (int i) - & gt; Int (*) [5] {returns (I% 2)? & Amp; Weird: & amp; Even;}
and asks to replace an exerices function so that it returns the reference for an array:
auto ArrPtr (int i) - & Gt; Int (& amp;) [5] {returns (i% 2)? Weird: Even;}
I do not understand that to convert it to the context of the array object you have to return the array object (if I understand the code I am right). Should the memory address of an array "Meth" not be completely in any reference type?
I do not understand that to change it in the context of array objects You have to return the array item (if I understand the code correctly).
Because this is how you start a context: By specifying the object it specifies that there is no extra audio. Points are started from other pointers, so you can see the & amp;
is required, generates a pointer.
Memory address should not be completely a "fit" array in a reference type?
Yes, references usually apply in the same way as indicators but their syntax should be affected? They are conceptually different things with different syntax (not an alternate name for an object, no value).
No comments:
Post a Comment