Wisdom Podcast c/c++--Note one

Source: Internet
Author: User

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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.