program is in memory (that is, it is loaded into memory when the program is loaded into memory).Note: You cannot use static for function parameters, for example:int wontwork (staticint// not allowed4° static variable with external linkageStatic variables with external links have file scopes, external links, and periods of static storage. This type is sometimes referred to as an external storage class, and this type of variable is called an external variable . Placing a definition declaration o
the C language, most statements end with a semicolon.A declaration statement specifies a variable name for a variable and identifies the data type stored in the variable, which is an identifier.An assignment expression statement assigns a value to a variable, which assigns the value to the storage space.The function expression statement is used to invoke the specified named function, and when the calling function finishes executing, the program returns to the statement following the function ca
;} Complex Complex::operator+(ConstComplex A)Const{Complex temp; Temp.real= Real +A.real; TEMP.IMGN= IMGN +A.IMGN; returntemp; /*return Complex (real + a.real, IMGN + A.IMGN);*///calling constructors directly//be accustomed to using this simplified statement//In general, the last statement, equivalent to the previous three, call the constructor will produce a temporary object, assigned to the left}complex Complex::operator-(ConstComplex A)Const{Complex temp; Temp.real= Real-A.real; TEMP.IMGN=
when a data item uses two or more types, but not both. Of course, the union size is the largest member of its storage.For enumeration types, only the enumerator used when defining the enumeration can be assigned to this enumeration variable without casting.enum Spectrum {Red,orange,yellow,green,blue};spectrum band=Blue;// ValidSpectrum Band2=2//Invalid, 2 not an EnumeratoAn enumeration type is defined only by an assignment operator, and an enumeration can be promoted to an int type, but an int
while loop can print the file content.
13.3.2 fgets () and fputs () Functions
The fgets () function accepts three parameters. The first parameter is used to store the input address. The second parameter is an integer, indicating the maximum length of the input string. The last parameter is a file pointer pointing to the file to be read.Fgets (buf, MAX, fp) This function reads the back of the first line break it encounters, or reads a character less than the maximum length of the string, or read
different values.Printf () uses a value, whether it is a variable, constant, or expression. 4.4.2printf () Conversion Modifier-: Left alignment+: If the signed value is positive, the plus sign is displayed. If the value is negative, the minus sign is displayed.Space: If the signed value is positive, the leading space is displayed. If the value is negative, the minus sign is used.#: Use an optional Form of conversion instructions. For all floating-poi
Fifth Chapter
1. For loop--for (initialization; test-expression update-expression) body//test-expression will be converted to bool,0 false, Non-zero to True
2, expression-an expression is a combination of values or values and operators. The value of an assignment expression is the value of its left member, and the assignment operator is combined from right to left.
3, a++ and ++a--
(1) For built-in types, the two execution efficiencies are the same.
(2) If the overloaded operator, for the c
returned.
4. pointer and object Summary
5. layout the new operator (positioning the new expression C ++ primer, the third edition)
In general, new is responsible for finding a memory block that meets the requirements in the heap memory. The new operator also has a variant: the placement new operator, which allows you to specify the location of the memory to be used. Programmers can use this feature to set their memory management procedures or proc
indicate symbol 4 instead of value 4.Some C implementations regard char as a signed type, and others as a non-Signed type. You can check this information through the limits. h header file.
The most basic form of a floating point constant is: A signed sequence of digits containing the decimal point, followed by the letter e or E, followed by a signed value representing the 10 index. For example,-1.56E + 12 and 2.87e-3.The positive number can be omitted. There can be no decimal point or exponent
array: int * p = new int [10]; P is the address of the first element of the element
(3), releasing the array: delete [] p; You can only release the memory allocated by new, cannot delete two times, the null pointer delete security, and the array is released with delete [].
(4), you cannot use the sizeof operator to determine the number of bytes that the dynamically allocated array contains.
(5), using an array: P[0] is the first element, and P[1] is the second. C + + Internal use pointers to
Exercise Review
1An integer cannot meet programming needs.2Short shit = 80;Unsigned shit= 42110;Auto shit = 3000000000;3Do not provide measures, please be careful433L is of the long type and 33 is of the int type.5Equivalent6(1) int shit = 88; std:
14.1 create a structure statement
Structure declaration is the main method used to describe how a structure is combined. The statement is as follows:Struct book {Char title [MAXTITL];Char author [MAXAUTL];Float value;};This statement describes a
C language is a powerful professional programming language, which is very popular among amateur and professional programmers.1.1 Origin
In 1972, Bell Labs developed C, a language developed for programmers.1.2 reason for use
1. The only way to C ++.2.
15.1 binary number, bit, and byte
A number represented by a base of 2 is called a binary number. A binary number can be used to represent any integer as a combination of 1 and 0. This system is very suitable for digital computers.
15.1.1 binary
16.1 step 1 of the translation procedure
Before preprocessing a program, the compiler will translate it several times.The compiler first maps the characters in the source code to the source character set.Second, the compiler searches for instances
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.