Teacher: Wang Paoming
1. Interface encapsulation and design idea guidance and preliminary practice
API Package Design:
Four-zone memory diagram:
Four District Introduction:
When writing a header file:
Avoid repeating multiple header files in. c
#ifndef _clt_socket2_h__
#define _clt_socket2_h__
...//second time not defined
#endif
As below:
#include "Cltsocket.h"
#include "Cltsocket.h"
#include "Cltsocket.h"
There is no error.
Warned:
1. Project/Code space management, numbering, easy to manage, view.
2. As a developer, file viewing methods are detailed and easy to find quickly.
Features of C + + learning:
Java Learning, Application, Project
C Learn, understand, apply and do projects
2. Sort warm-up and array function parameters degenerate to pointer extension
Bubble Sort Core code:
1 PrintfArray3 (a);2 3 for(i=0; i<Ten; i++)4 {5 for(j=i+1;j<Ten; J + +)6 {7 if(A[i] <A[j])8 {9TMP =A[i];TenA[i] =A[j]; OneA[J] =tmp; A } - } -}
Conclusion
1 arrays do function parameters and degenerate into pointers
2 Char buf[30],int a[10], which appears in the parameter , is used as a pointer and does not actively allocate memory,C, C + + the compiler will automatically optimize: degenerate to pointer
int i = 0;
int num1 = sizeof (a); The formal parameter is a[10]:sizeof (a) = = sizeof (int *) is equivalent to a pointer, only 4 bytes
int num2 = sizeof (*A);
int num = sizeof (a)/sizeof (*a); num = 1, not the length of the array
int num1 = sizeof (a); data types are different
3 sizeof (a) the difference in size is that the data type of a is different because the array function parameter is degraded to the pointer
vs Notes:
Shift+del Delete a row
Ctlr+u make words from small to upper case
Shift+ctrl+u from size to lowercase
Wisdom Podcast c/c++--Note one