String connection
Here is the problem of passing string pointers, starting to write * p in the method, then seeing P pointer, but because he is from Malloc, it must be fly (), look at the forum: " The principle should try to follow as much as possible, that is, allocation and recycling memory should be done as much as possible in the same scope. It is best to avoid allocating space in the subroutine, reclaiming the parent program. To absolutely avoid allocating space in the parent program , In a sub-program, recycling, unless the unique function of the primary, is the recycled memory. "
There is also char a [] = "jklmn", is an array containing six functions, because it also includes '/ 0'; # include "stdafx.h" #define Len 15 # Define LONGER A> B? A: B Void stradd (Char * p, char SRTFRONT [], char SRTBACK []) {INT A, B, C, I; A = (int) strlen (SRTFRONT); B = (int) strlen; c = a B 1; I = longer; for (int MARS = 0; MARS
INT _TMAIN (int Argc, _tchar * argv []) {
Char a [] = "abcdefghi"; char b [] = "jklmn"; char * p; p = (char *) malloc (sizeof (char) * (15)); stradd (p, a, b); printf ("% s / n", p); free (p); system ("pause"); return 0;}
2. Single-lapse table Add, delete nodes.
Mainly, it is good to understand the way the node is handled in the list.
#include
Struct Lnode {Int Number; Struct Lnode * Next;} * linkList, * P1, * P2, * New, * PRI
Void CreatList (struct lnode * l, int N) {INT i; for (i = 0; i
Void ListDeled () {Int Site, I; Printf ("please enter the int:"); scanf ("% d", & site); p1 = (struct lnode *) malloc (SIZEOF (Struct Lnode); p1 = linklist ; I = 1; While (i
INT Main (int Argc, char * argv []) {Int i = controller (); while (i = 1) {controller ();} system ("pause"); return 0;}
3. Test the size of the terminal method
INT i = 1; char * pc = (char *) (& I); pc ; if (* pc == 0) Printf ("Small / N"); Else Printf ("Large End / N"); INT 1 The hexadecimal representation is 0x00000001, stores 01000000 in a small-end method machine, which is not equal to 1 when the PC pointing the next address, that is, 0, indicating that the machine is small, otherwise the big end method