See the followingCodeAs shown in:
Copy codeThe Code is as follows: # include
# Include
# Include
# Include
# Include
# Include
# Include
Int main (INT argc, char * argv [])
{
Pid_t PID;
Int Stat;
Int exit_code;
PID = fork ();If
1. System (execute shell command)
Related functions Fork, execve, waitpid, popen
Header file # Include
Define functions INT system (const char * string );
Function Description System () calls fork () to generate sub-processes, which
We know that,
During C ++ development, the class destructor used for base classes are generally virtual functions.But why? Here is a small example:
There are two classes:
Copy codeThe Code is as follows: class ClxBase
{
Public:
ClxBase
1.When a target object is constructed using the source object of the same class, the copy constructor is called to construct the target object. If no copy constructor is defined, call the default copy function of the class to construct the target
PrototypeExtern char * strcat (char * dest, char * src );
Usage# Include
FunctionAdd the string indicated by src to the end of dest (overwrite '\ 0' at the end of dest) and' \ 0 '.
DescriptionThe memory areas specified by src and dest cannot
Before talking about function calls and return values, let's take a look at the issue of memory allocation in C ++.
The C ++ compiler divides computer memory into code and data areas. Obviously, the code area stores program code, the data zone
I,The struct in C ++ expands the struct in C. It is no longer just a data structure that contains different data types. It has obtained too many functions.
Can struct contain member functions? Yes!Can struct be inherited? Yes !!Can struct realize
Volatile means "easy to lose, easy to change ". The definition of this qualifier indicates to the compiler that the content of the variable may change due to modifications to other programs. When a variable is declared in a program, the compiler
The Code is as follows:
Copy codeThe Code is as follows :/*
*
Bubble Sorting*/
Void BubbleSort (int arr [], int n)
{
Int temp;
For (int I = 0; I {
For (int j = I + 1; j {
If (arr [I]> arr [j])
{
Temp = arr [I];
Arr [I] = arr [j];
Arr [j] = temp;
}
}
I don't know when to start. I deliberately avoid changing the variable value in the for loop. It seems to be influenced by others' opinions, but I don't know the reason.
However, sometimes it is not convenient to use other methods. I tried it
The Code is as follows:
Copy codeThe Code is as follows: # include
Int main ()
{
Int pos = 2;
Int neg =-2;
Int mid = 0;
If (pos)
Printf ("pos./n ");
If (neg)
Printf ("neg./n ");
If (mid)
Printf ("mid./n ");
Printf ("------------/n ");
Macro definition containing if
When the macro definition contains if
1) define the following macro# Define DC (p) if (foo (p) fun (p)
Used in the following Environment
If (k> n)
DC (k );
Else
DC (n );
After macro replacement
If (k> n)
If
Personal implementation example:
Copy codeThe Code is as follows: # include
# Include
# Define M 4
Int add (int a, int B );
Int sub (int a, int B );
Int mul (int a, int B );
Int div (int a, int B );
Int (* oper_func []) (int, int) = {
Add, sub,
Use today
FtruncateThe file is truncated, but it cannot achieve the expected results. After the file is truncated, the content is complex and the file size remains unchanged.
After adding fflush () and rewind (), OK.
The following is the test
The Code is as follows:
Copy codeThe Code is as follows: # include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
Char ** bak_argv;
Int flag = 0;
Void restart (void );
Void sighup_handler (int sig );
// Argv [0] use
Many times, when using some special libraries to compile executable programs, you need to add additional CFLAGS and LIBS. otherwise, the system will prompt that the specified header file cannot be found or "undefined reference... "error message.
If
This is only part of instruction parsing, but it is the most
Core. The complete command is AT + REG [admin] [2] [00: 0C: 29: AA: 0B: A7].
/*************************************** *************************
** File: GetParameters. c
** Brief
In the project development project, if you can determine which file
Which function has an error? That is, the lock error.That's good. This article is for this.
First, let's take a look at the default output function of the file:
File Information
The method for Traversing various data sets in C # is summarized here:
1. Enumeration type
Copy codeThe Code is as follows: // traverse the enumerated names of the enumeration type samples.
Foreach (string sp in Enum. GetNames (typeof (Sample )))
{
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