How to comprehend the complicated statement of Cmax CumberPlus in C++
Many beginners are not very clear about how to understand the complex Champact statement in C++. In order to help you solve this problem, the following editor will explain it in detail for you. People with this need can come and learn. I hope you can get something.
How to learn and understand the complex type declaration of C and C++, the following article begins to teach you step by step how to understand this complex Cash Cure + declaration. This article will explain the profound meaning of the Cmax Cure + declaration and describe in detail the methods and techniques for the use of the Cmax Cure + declaration.
We'll start with the simpler declarations you come across every day, and then gradually add const modifiers and typedef, as well as function pointers, to introduce a "right-left rule" that allows you to accurately understand any Cpassword + declaration. What needs to be emphasized is that.
Complex C _ statements is not a good programming style; I'm just here to teach you how to understand them. Note: to ensure that the code and related comments are displayed on the same line, this article is read on a monitor with at least 1024x768 resolution. Let's start with a very simple example, as follows:
Const int nasty 5; int const massively 10
This should be understood as "declare p as an int *" (p is an int * variable), or p is a pointer to an int variable. I'd like to discuss it here: I think when declaring a variable of a pointer (or reference) type, * write * (or &) immediately before the variable, not immediately after the base type. In this way, some misunderstandings can be avoided, such as:
# include # include int main () {string word; while (cin > > word) cout