In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
The content of this article mainly explains "what is the application of C++ parameter transmission", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what is the application of C++ parameter transfer?"
Citation is a concept in C++, and beginners tend to confuse references with pointers. In the following program, n is a reference of m and m is a referent.
Int m; int & n = m
N is equivalent to the alias (nickname) of m, and any operation on n is an operation on m. So n is neither a copy of m nor a pointer to m, in fact n is m itself.
An overview of various commonly used C++ class libraries
Introduction to the Application Technology of dynamic object creation in C++
Basic Application Guide for C++ to call python script functions
Introduction to the basic concept of C-style string in C++
An Overview of the basic Concepts of C++ string types
Referenced rules:
(1) the reference must be initialized at the same time it is created (the pointer can be initialized at any time).
(2) there cannot be a NULL reference, which must be associated with a legitimate storage unit (the pointer can be NULL).
(3) once the reference is initialized, the relationship of the reference cannot be changed (the pointer can change the object at any time).
In the following example program, k is initialized as a reference to I. The statement k = j does not change k to a reference to j, just changes the value of k to 6. Because k is a reference to I, the value of I also becomes 6.
The values of int I = 5; int j = 6; int & k = I; k = j; / k and I become 6
The main function of a reference is to pass the parameters and return values of the function. In C++ language, there are three ways to pass parameters and return values of functions: value, pointer and reference.
The following is an example program of "value passing" in C++ parameter passing.
Since x in the Func1 function is a copy of the external variable n, changing the value of x does not affect n, so the value of n is still 0.
Void Func1 (int x) {xx = x + 10;}... Int n = 0; Func1 (n); cout
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.