• <small id='7sZiK'></small><noframes id='7sZiK'>

    <tfoot id='7sZiK'></tfoot>

        <bdo id='7sZiK'></bdo><ul id='7sZiK'></ul>
      1. <legend id='7sZiK'><style id='7sZiK'><dir id='7sZiK'><q id='7sZiK'></q></dir></style></legend>
      2. <i id='7sZiK'><tr id='7sZiK'><dt id='7sZiK'><q id='7sZiK'><span id='7sZiK'><b id='7sZiK'><form id='7sZiK'><ins id='7sZiK'></ins><ul id='7sZiK'></ul><sub id='7sZiK'></sub></form><legend id='7sZiK'></legend><bdo id='7sZiK'><pre id='7sZiK'><center id='7sZiK'></center></pre></bdo></b><th id='7sZiK'></th></span></q></dt></tr></i><div id='7sZiK'><tfoot id='7sZiK'></tfoot><dl id='7sZiK'><fieldset id='7sZiK'></fieldset></dl></div>

        变量等末尾的与号 (&amp;)

        ampersand (amp;) at the end of variable etc(变量等末尾的与号 (amp;))

          • <i id='4WOpB'><tr id='4WOpB'><dt id='4WOpB'><q id='4WOpB'><span id='4WOpB'><b id='4WOpB'><form id='4WOpB'><ins id='4WOpB'></ins><ul id='4WOpB'></ul><sub id='4WOpB'></sub></form><legend id='4WOpB'></legend><bdo id='4WOpB'><pre id='4WOpB'><center id='4WOpB'></center></pre></bdo></b><th id='4WOpB'></th></span></q></dt></tr></i><div id='4WOpB'><tfoot id='4WOpB'></tfoot><dl id='4WOpB'><fieldset id='4WOpB'></fieldset></dl></div>

            <small id='4WOpB'></small><noframes id='4WOpB'>

                <tbody id='4WOpB'></tbody>
              <tfoot id='4WOpB'></tfoot>

                <bdo id='4WOpB'></bdo><ul id='4WOpB'></ul>
                <legend id='4WOpB'><style id='4WOpB'><dir id='4WOpB'><q id='4WOpB'></q></dir></style></legend>

                  本文介绍了变量等末尾的与号 (&amp;)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!


                  我是 C++ 菜鸟,我在理解代码中的 C++ 语法方面遇到了问题.现在我很困惑.

                  I am a C++ noob and i've a problem of understanding c++ syntax in a code. Now I am quite confused.

                  class date
                  int day, month, year;
                  int correct_date( void );
                  void set_date( int d, int m, int y );
                  void actual( void );
                  void print( void );
                  void inc( void );
                  friend int date_ok( const date& );


                  Regarding to the '&' character, I understand its general usage as a reference, address and logical operator...

                  例如 int *Y = &X

                  for example int *Y = &X

                  & 是什么意思?参数末尾的运算符?

                  What is the meaning of an & operator at end of parameter?

                  friend int date_ok( const date& );



                  Thanks for the answers. If I have understood this correctly, the variable name was simply omitted because it is just a prototype. For the prototype I don't need the variable name, it's optional. Is that correct?


                  However, for the definition of the function I definitely need the variable name, right?


                  const date& 被方法 date_ok 接受意味着 date_ok接受 const date 类型的引用.它的工作原理与指针类似,只是语法稍微有点……含糖

                  const date& being accepted by the method date_ok means that date_ok takes a reference of type const date. It works similar to pointers, except that the syntax is slightly more .. sugary

                  在您的示例中,int* Y = &x 使 Y 成为 int * 类型的指针,然后为其分配地址x.当我想更改Y 指向的地址中的任何内容"的值时,我说 *Y = 200;

                  in your example, int* Y = &x makes Y a pointer of type int * and then assigns it the address of x. And when I would like to change the value of "whatever it is at the address pointed by Y" I say *Y = 200;


                  int x = 300;
                  int *Y = &x;
                  *Y = 200; // now x = 200
                  cout << x; // prints 200


                  int x = 300;
                  int& Y = x;
                  Y = 200; // now x = 200
                  cout << x; // prints 200

                  这篇关于变量等末尾的与号 (&amp;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



                  C++ stl unordered_map implementation, reference validity(C++ stl unordered_map 实现,参考有效性)
                  C++: Is it possible to use a reference as the value in a map?(C++:是否可以使用引用作为映射中的值?)
                  Where ampersand quot;amp;quot; can be put when passing argument by reference?(其中符号“amp;通过引用传递参数时可以放置吗?)
                  Why can a non-const reference parameter be bound to a temporary object?(为什么可以将非常量引用参数绑定到临时对象?)
                  What is a dangling reference?(什么是悬空引用?)
                  C++ reference changes when push_back new element to std::vector(当 push_back 新元素到 std::vector 时,C++ 引用发生变化)
                    <bdo id='f7CC9'></bdo><ul id='f7CC9'></ul>
                    <legend id='f7CC9'><style id='f7CC9'><dir id='f7CC9'><q id='f7CC9'></q></dir></style></legend><tfoot id='f7CC9'></tfoot>

                    <i id='f7CC9'><tr id='f7CC9'><dt id='f7CC9'><q id='f7CC9'><span id='f7CC9'><b id='f7CC9'><form id='f7CC9'><ins id='f7CC9'></ins><ul id='f7CC9'></ul><sub id='f7CC9'></sub></form><legend id='f7CC9'></legend><bdo id='f7CC9'><pre id='f7CC9'><center id='f7CC9'></center></pre></bdo></b><th id='f7CC9'></th></span></q></dt></tr></i><div id='f7CC9'><tfoot id='f7CC9'></tfoot><dl id='f7CC9'><fieldset id='f7CC9'></fieldset></dl></div>

                            <tbody id='f7CC9'></tbody>

                            <small id='f7CC9'></small><noframes id='f7CC9'>