Write good C language, beautiful macro definition is very important, the use of macro definitions can prevent errors, improve portability, readability, convenience and so on. The following is a list of commonly used macro definitions in mature
Some time ago, prepare to design a table about error information, each error has a unique Errid, and the corresponding error message and other auxiliary information. In the C language, it is natural to achieve the following:
enum { Err_id_1,
The following example defines two structures, and because of the existence of strings in the member, the struct uses a character array, while struct two uses a character pointer.
#include #define LEN 20 struct info { char first[LEN]; char
If we think of the operating system and the various software on the computer as a series of organic life, not the instruction set, then this is a process of the world, in the process of the world also has "moral" and "Law and order", spying on the
The memory image is actually creating an image in memory that is exactly the same as the external storage file. The user can map the entire file to memory or partially to memory. The system will reflect the memory image changes truthfully reflected
Linux implementation of the request page scheduling, page scheduling is to say that the page from the hard disk on-demand exchange come in, when no longer need to exchange out. This allows the virtual address space of each process in the system and
Table of Contents
Profile
Understanding String (basicstring)
About TempString base Classes
Source
Reference reading
Profile
As we know, the C + + standard library (STL) provides string manipulation by the Basic_string class. The string is
1 constructors
Create a disconnected IPv4 datagram Socket:
Datagramsocket ();
Creates a datagram Socket that specifies the IP type (IPV4 or IPV6):
Explicit Datagramsocket (ipaddress::family Family);
Create a datagram Socket with a specified
C Program Common symbol definition header file, also includes 10 kinds of C compilation environment detection: DOS (MSC, BC), VMS, as/400, four Unix, etc.
/*Cmndef. H--Common #define SYMBOLS for C functionsM.l.y 1996.08, 1999.06, 2000.07.19, 2000.12
Static members can also be defined in a class, but static members are public to all objects. Static members are divided into static data members and static member functions.
1. Static data members
The way to define a static data member in a class
"Program 11"
Title: Classical question: There are a pair of rabbits, from the 3rd month after the birth of a pair of rabbits each month, the rabbit long to the third month after the birth of a pair of rabbits each month, if the rabbit is not dead,
The output is mainly done by the overloaded left-shift operator (>).
>>a represents putting data into a object.
Next we continue to look at the C + + style of streaming control, C + + introduced the Ostringstream, Istringstream, StringStream
We may often write code like this:
int add (int a, int b)
{
return a + B;
}
Of course, this is a reasonable notation, so that the return value of the function is int, so calling the function returns a value of int.
Today, I want to discuss the
1. Conflict resolution based on separation chain
1.1 Main storage structure
struct ListNode { ElementType Element; Position Next; };
This is the structure that stores the data and is actually a linked list.
typedef struct ListNode
An enumeration (enum) is actually an easy to remember symbol for a set of logically inseparable integer values. For example, we declare a variable that represents the enumeration type of the week:
Enum
To implement an ActiveX control using C #, three issues need to be resolved:
1. Enable. NET components to be invoked by COM
2. After registering with the client, the ActiveX control can be authenticated by IE security
3. When not registered on
Title: Enter a binary search tree and convert the two-fork search tree into a sorted two-way list.
Requires that no new nodes can be created, only the pointer to the node in the number of points can be adjusted.
Method: Use the middle order to
Algorithm logic: According to the size of the node, set up the tree, output the root node of the tree, and reset this to the maximum value, and then refactor the tree.
Because some of the comparison logic is preserved in the tree, the number of
The heap sort contains two steps:
The first step: is to establish a large top heap (from large to small sort) or a small top heap (from little to large sort), from the bottom up; When the heap is built, S is from large to small;
The second step:
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