Compilation preprocessing is the initial step in the process of converting a C source program into an executable program. This step is done by the preprocessor (preprocessor). Before the source program is processed by the compiler, the preprocessor
Binary tree creation and traversal (non-recursive traversal left and right, destroy tree structure) create a recursive 3-way traversal of a two-fork tree:1, first center, then left tree, then right tree2, first left tree, then center, then right
Linux obtains IP and NIC information for the machineThe code comes from the network, I rewrite, have the United States dare not self-specialized, special share. The usage is simple, just 3 functions.Header file Getmac.h:/** * getmac.h * * 2014-07-08:
Macro definition that contains if
When the macro definition contains an IF
1) define the following macros#define DC (P) if (foo (p)) fun (p)
Used in the following environment
if (k>n)
DC (k);
Else
DC (n);
After the macro is replaced, the following
Original address: http://c4fun.cn/blog/2014/03/06/libev-study/
----
Intro
Libev is a reactor-based event library with high efficiency (Benchmark) and code refinement (4.15 versions over 8,000 lines), which is a great resource for learning
Application of Variable parameters in macro definition in C Language
In the C standard library, input and output functions of printf, scanf, sscanf, sprintf, and sscanf are variable parameters. When debugging a program, we may want to define a
When we mention preprocessing, we can't help but think of a classic problem.
Is the C language simple? Simple. The C language does not have much syntax, so I will soon learn it.
Indeed, the C language is much simpler without preprocessing. But once
This article describes how to develop a horizontal scrolling shooting game.1. Rebuild the background in the codeCreate a node ParallaxBackground in the project. The header file is very simple./** ParallaxBackground. h** Created on: 2012-9-18* Author:
Macro definition containing if
When the macro definition contains if1) define the following macro# Define DC (p) if (FOO (p) Fun (P)Used in the following EnvironmentIf (k> N)DC (k );ElseDC (N );After macro replacementIf (k> N)If (FOO (k ))Fun (k )
Document directory
Use...
Incorrect nesting-misnesting
Problems caused by operator priority-operator precedence Problem
Remove unnecessary semicolons-semicolon swallowing
Duplication of side effects
To
The previous section introduced the knowledge about System V shared memory. Now let's take a look at POSIX shared memory and functions.
Shared Memory is simply a real physical memory area. Some functions can be used to map this area to the address
1. open the file kernel data structure
1. A process opens two files
File status flag: read, write, append, sync, non-blocking, etc.
2. A process opens the same file twice
3. Two processes open the same file
Example program:
C ++ code
When using a command-optimized compiler, do not think that commands will be executed strictly in the order they appear in the source code. For example, the compiler may reschedule assembly language instructions to enable optimal use of registers. In
1. Typical UDP client/server communication process
Following the communication process, we will implement a UDP redirection Client/Server.
# Include # Include
Ssize_t send (INT sockfd, const void * Buf, size_t Len, int flags );
Ssize_t sendto
Do {...}While (0); // while (false)TIPS:
1. Use in macros:See the following situation:# Define swap (x, y) {int TMP = x; X = y; y = TMP ;}If this is the case during use:If (condition) Swap (A, B);Else {...}Will be replaced with: If (condition) {int
01: prevent a header file from being repeatedly contained
# Ifndef COMDEF_H# Define COMDEF_H// Header file content# Endif
02: redefines some types to prevent the differences in the number of bytes of the types caused by different platforms and
One problem is how to delete two characters with the same string, such
Str1 = "abcdeafg" str2 = "blimklaaaaa"
To get:
Str1 = "cdefg" str2 = "limkl"
Write the program directly below. I wrote this program, but the idea is others '.
For the
Cocos2d-x 3.1.1 Study Notes [18] Sprite creation tour, cocos2d-x3.1.1
// Input a string to create an Sprite * Sprite: create (const std: string & filename) {// request a memory block from the system/* std :: when nothro has insufficient memory,
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.