Knowledge Interest-c++

Knowledge Interest-c++,

Memory stack area: store the names of local variables.
Memory heap area: store objects from new or malloc.
Constant area: store the values ​​of local variables or global variables.
Static area: store static variables and global variables.
Code area: store binary codes.

//main.cpp 
 
int a = 0; 全局初始化区 
 
char *p1; 全局未初始化区 
 
main() 
 
{
    
     
 
int b;// 栈 
 
char s[] = "abc"; //"abc"在常量区,s在栈上。 
 
char *p2; //栈 
 
char *p3 = "123456"; //123456\0";在常量区,p3在栈上。 
 
static int c =0//全局(静态)初始化区 
 
p1 = (char *)malloc(10); 
 
p2 = (char *)malloc(20); 
 
//分配得来得10和20字节的区域就在堆区。 
 
strcpy(p1, "123456"); //123456\0放在常量区,编译器可能会将它与p3所指向的"123456"优化成一个地方。 
 
} 

Constructor: is a method of initializing an object when it is created.
Friendship function: A function defined outside the class, but has access to all private and protected members of the inner class; friendship destroys the encapsulation.
Member functions: ordinary functions in the class.

Polymorphism: It is not clear at compile time, and the method is determined when the program is running.

Pointer: Point to memory address; Pointer is a variable and can be changed; There is a null pointer.
Reference: the alias of the variable; it must be initialized before use, and cannot be changed after initialization; there is no reference to a null value.

TCP measures to ensure reliable transmission:
provide timeout retransmission,
discard duplicate data,
verify data,
flow control

Traversal of a two-dimensional list in python:

list2d = [[1,2,3],[4,5,6]]
sum = 0
for i in range(len(list2d)):
    for j in range(len(list2d[0])):
        sum += list2d[i][j]
print(sum)

How to determine whether a list contains an element in Python

if a[i] in a:

Deadlock: Several processes wait endlessly for other processes to release the resources they have occupied.

The three elements of
recursion : the purpose of
recursion, the termination condition of recursion,
find the equivalence relation of the function, that is, the recursion relation

Guess you like

Origin blog.csdn.net/qq_40092110/article/details/108663480