C++ learning notes

https://www.cnblogs.com/zhengfa-af/p/8108187.html //dll production
1, ifndef _test_h (uppercase) in the header file

#ifndef _TEST_H

#define _TEST_H // Generally the uppercase of the file name

Write a line at the end of the header file:

#endif
When multiple files contain this header file at the same time, the redefinition error will not occur.
Second, the namespace
namespance (space name) {variable function};
there are many ways to call the functions and variables of the namespace, such as:
1.
Space name:: method ();
2.
using space name:: method name;
method ()
3. using namespace space name (at the top, the entire file can use the method directly in the namespace)

Tips for converting from binary to decimal 1010 (128, 64, 32, 16, 8, 4, 2, 1) is calculated according to the position of 1, for example: 1010 8 +2

The trick to convert binary to hexadecimal is 1010 (8+2 is A) such as 01 0010 1010 1010 1+2+A+A=12AA

resource hacker past Trojan editor

C++ does not support returning the address of a local variable outside a function, unless the local variable is defined as a static variable.

C++ pointer has two operators & * The
so-called pointer is the variable that stores the address of another variable
& takes the address
* takes the value

Function
call by parameter
pointer call will modify the corresponding value. Call transfer address in easy language
// Function definition
void swap(int *x, int *y)
Reference call will modify the corresponding value
// Function definition
void swap(int &x, int &y)

The c++ method has a default value. Does java have int max (int a=0;int b=99); if no parameters are passed in, these are the two

c++ The parameter name is not important, as long as there is a parameter type, such as
int max(int, int);

An array is a pointer to array 0 (an array is a pointer)
so a string can be defined like this
char str[]="hello";
char * str1="pointer string";

c++ also supports lambda expression https://www.cnblogs.com/DswCnblog/p/5629165.html
//[](int x, int y){ return x <y;} (parameter)
cout<<“lambda expression Type!" << [](int x, int y){ return x <y;} (1,2) << endl;

Guess you like

Origin blog.csdn.net/qq_35189120/article/details/83410407