5.2. socket () --- get the file descriptorI don't want to talk about it for a long time-I want to call the system function socket (). The following is his prototype:
# Include
# Include
Int socket (intdomain, int type, int protocol );
But what
# Include # Include # Include Int main (void){Int m, n;Time_t t;Srand (unsigned) time (& t); // The srand function is the initialization function of the random number generator. If not, the same random number is generated each time.M = rand (); //
5.11. gethostname () --- who am I?The gethostname () function is even simpler than getpeername (). It returns the Host Name of the machine where your program runs. Then you can use gethostbyname () to obtain the IP address of your machine.
The
Chapter 3 C language statement analysisConst int * grape;
Int const * grape;
Int * const grape;
In the last case, the pointer is read-only, and the above two pointers indicate that the object is read-only;
Struct can be used for field bits. I have
1. Copy the library file and header file of OpenGL. If you do not have OpenGL library files and header files, you can search and download them from the Internet, which is easy to find. Copy the. dll file (including four files: glu. dll, glut. dll,
This memo is a question sent by my classmates. I did forget whether I encountered this problem when I was learning. I rarely used it like this, in addition, pure mathematical computation has never been written. It is better to use matlab.
In fact, C
When using a third-party unmanaged API, we often encounter a pointer with a parameter of pointer or pointer,Generally, we use IntPtr to point to the parameter address we need to pass;
But how can we use IntPtr correctly when we encounter such an
Const in C language has always been a pain point for beginners in C language. This is because const has different functions in different locations and has different roles in different scenarios. This leaves beginners confused. Today, I will study
In C language, there are many functions related to file read/write, but there are two types of read/write data: Binary and text. The text read and write functions are not mentioned much. As long as formatted input and output fscanf () and fprintf ()
Iterator)
Iterator:Iterators are pointer-like objects. STL algorithms use them to traverse object sequences stored in containers.Five types: 1. Input iterator2. Output iterator3. Forward iterator4. Bidirectional iterator5. Random Access
Enter the first letter of the day of the week to determine the day of the week. If the first letter is the same, continue to judge the second letter.1 # include 2 # include 3 int main ()4 {5 char letter;6 printf ("please input the first letter: \ n
Thread advantages (process comparison ):1. Low overhead2. Since the same process, each thread can easily access Shared data.Typical thread applications: asynchronous processing mechanism; processing blocking IO;The thread function is defined in
Evaluate delta and select this course (unselectedThe score is 0). The score + delta is used to calculate the average score of the course. The average score is equal to the average score of all the students selected for the course. 1 # include 2 #
/*Question: enter some big integers and output the sum of them. A major error cause is found in this question, that is, initialization at ②.*/# Include # Include Const int nmax= 200;Struct BigNumber{Int data [nMax];Int len;BigNumber () {len = 1;
Insert sorting is the simplest and most crude sorting method, the basic idea is: For the sorted first I-1 number, insert the number I to the appropriate positionTime Complexity: O (n ^ 2) /* Insert sortingTime Complexity: O (n ^ 2)*/
# Include
Void
The reason is that I have read the article, and the subject is taken from "C ++ meditation". I have made full use of several design patterns and combined the so-called object-oriented techniques, and then gained my own strength, in the end, I also
In terms of performance optimization, we always pay attention to the 80-20 principle, that is, 20% of the program consumes 80% of the running time. Therefore, to improve the efficiency, we mainly consider improving the 20% code. Do not optimize the
# Macro string connection. The macro parameter is interpreted as a string and cannot be directly used in statements. In macro definition
Printf ("% s;/n", # S) will be interpreted
Printf ("% s;/n", "S ")
For example, the following code
# Define
I wrote a program with g ++, and one of them is
For (I = 0; I
Push_back ();
This code has been called N times. When it is called for a certain number of times, the above error is reported when it is executed to push_back. Use gdb to read it one
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