The best programming language section of the programmer interview guide, a programmer Interview Guide

Source: Internet
Author: User
Tags define find

The best programming language section of the programmer interview guide, a programmer Interview Guide
Best programming language in programmer Interview Guide

  • The essence is called to get its dregs. This article keeps in mind some key knowledge points and error points recorded in the programmer interview guide, and does not record some important points that are not clearly explained in the book. Of course, the scum here only refers to less important or relatively simple, not to say that the writing is not good. I hope you don't need to read this book again later. You just need to read the essence of the book.
  • There are a few bugs in this article, which are also excerpted here.
  • This article focuses on the programming language, including chapter 5 to Chapter 9.
Chapter 5 language details
  • 5.1y = z = 5The equal sign is used to calculate the right, and the return value is the variable value on the left after the value is assigned.
  • 5.1 when the expression in the printf function is pressed from right to left, the value on the right should be calculated first.
  • 5.4 float 1.0f in memory: 0x3f 80 00
  • 5.5 variables in expressions with int constants are usually upgraded to int type.
  • 5.5 The Value assignment operator combines right-to-left by default, that is, the right-side value is calculated first.
  • 5.5 (x & y) + (x ^ y)> 1) the result is the average of the two.
  • 5.6 you do not need to judge the large one in a and B using the switch statement: (a + B) + abs (a-B)/2
  • 5.7extern "C"Usage: added before function declaration to solve the different problems of C/C ++ compiler name Packaging
Chapter 6 preprocessing, const and sizeof
  • 6.1 calculate the offset of a member in the struct:#define FIND(struc, e) (size_t)&(((struc *)0)->e)
  • 6.2 C language,const n = 10; char carray[n]Yes, because the C compiler cannot regard const as a constant during compilation. But the experiment is correct, bug
  • In 6.3 C ++, you can use the const function to modify the mutable modifier for class member variables.
  • 6.3 structure alignment principle: the length of the structure must be an integer multiple of the longest data element. However, if the length is greater than the number of processor digits, the length is aligned with the number of processor digits. The CPU Data Alignment principle is that the data memory address must be an integer multiple of the Data Length to improve the running speed.
  • 6.3 sizeof (string) = 4
  • 6.3 The null class and (multiple) inherited null class are all 1, but the virtual inherited class contains a virtual table pointer with a size of 4
Chapter 7 pointer and reference
  • 7.1 differences between pointers and references
    • The reference is always non-null, And the pointer may be null. Be careful when using the reference.
    • The reference cannot point to another object, but the pointer can be changed.
  • 7.1int *p; *p = 0;Yes. The pointer p does not point to an actual address.
  • 7.2char a[] = "a"In the stack where the array is stored, function return disappears,char *a = "a"The array is stored in the global read-only data segment.
  • 7.2 If Class B inherits Class A and both have member variables. If Class A contains the f methodB b; b.f()Call f in A, and f uses the variable in.
  • 7.3 The pointer to const should beconst int *, Bug
  • 7.3int ( *(*f)(int, int) )(int)Defines a function pointer and receives two int parameters. The returned value is a function pointer.
  • 7.4 The pointer to an integer array is declared:int (*p) [], The pointer array pointing to an integer is declared:int *p[], Function pointer array declaration:int (*p[10])(int)
  • 7.5 floating pointer refers to the pointer after the delete operation, so that the pointer should be equal to 0, so that subsequent programs can use this floating pointer to make the error controllable. For example, the second delete
  • 7.5 difference between new/delete and malloc/free
    • The former is an operator, and the latter is a function.
    • In addition to applying for and releasing dynamic memory, the former performs class initialization and destructor for non-built-in types.
  • 7.6 when copying in autoptr, only one pointer is reserved, so it is not suitable for storing in the container.
Chapter 9 STL templates and containers
  • 9.1 if the copy constructor is not overloaded and contains a pointer, the pointer will be copied when the copy constructor is called, resulting in multiple delete operations on the same pointer.

  
  

Reprinted by: Focustc. The blog address is http://blog.csdn.net/caozhk. The original link is opened by clicking
  
  
, The electronic "C ++ programmer interview book" (Liang Zhenyu) and "Programmer interview book", first

Hello!
The two books you want are all in this package! All are in PDF format! I don't know what meets your mind, do you?
I hope my answer will help you! Hope to adopt it! Thank you!


Download the txt full set of "Programmer Interview Guide"

The attachments to the txt full set of Novels of the programmer's interview book have been uploaded to Baidu online storage. Click here for free download:
Find me if you have any questions.


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.